Calculate the number of intersection points

Assignment Help Other Subject
Reference no: EM133002370

CPSC 231 Introduction to Computer Science

Assignment: First Program/Analytical Geometry

Collaboration
Discussing the assignment requirements with others is a reasonable thing to do, and an excellent way to learn. However, the work you hand-in must ultimately be your work. This is essential for you to benefit from the learning experience, and for the instructors and TAs to grade you fairly. Handing in work that is not your original work, but is represented as such, is plagiarism and academic misconduct. Penalties for academic misconduct are outlined in the university calendar.

Here are some tips to avoid plagiarism in your programming assignments.

1. Cite all sources of code that you hand-in that are not your original work. You can put the citation into comments in your program. For example, if you find and use code found on a web site, include a comment that says, for example:

Use the complete URL so that the marker can check the source.

2. Citing sources avoids accusations of plagiarism and penalties for academic misconduct. However, you may still get a low grade if you submit code that is not primarily developed by yourself. Cited material should never be used to complete core assignment specifications. You can and should verify and code you are concerned with your instructor/TA before submit.

3. Discuss and share ideas with other programmers as much as you like, but make sure that when you write your code that it is your own. A good rule of thumb is to wait 20 minutes after talking with somebody before writing your code. If you exchange code with another student, write code while discussing it with a fellow student, or copy code from another person's screen, then this code is not yours.

4. Collaborative coding is strictly prohibited. Your assignment submission must be strictly your code. Discussing anything beyond assignment requirements and ideas is a strictly forbidden form of collaboration. This includes sharing code, discussing code itself, or modelling code after another student's algorithm. You can not use (even with citation) another student's code.

5. Making your code available, even passively, for others to copy, or potentially copy, is also plagiarism.

6. We will be looking for plagiarism in all code submissions, possibly using automated software designed for the task. For example, see Measures of Software Similarity

7. Remember, if you are having trouble with an assignment, it is always better to go to your TA and/or instructor to get help than it is to plagiarize. A common penalty is an F on a plagiarized assignment.

Goal
Writing a first program in Python using I/O, casting, expressions, and conditionals.

Description

Analytical Geometry
You will create a small graphical Python 3 program that draws a few shapes using the turtle library and information taken from the user. You will also use the Python math library to do calculations (no other libraries are allowed for your math calculations). Your TA will introduce you to these libraries and their details during tutorials, so please attend the tutorials.

The assignment requires you to understand constants, magic numbers, variables, expressions, as well as importing and using libraries, getting input from users, casting variables to different types, problem- solving, and drawing in a coordinate system. It is possible to make use of functions for this assignment if you understand them. However, if your program does not function correctly due to a failed attempt, you will lose grades. There are no bonus grades for using functions. There are bonus grades for using loops, which is discussed at the end of this document.

Your program will present an 800x600 pixel window with (0,0) being the bottom left corner point and (800,600) being the top right corner point. Within this coordinate system, your program will draw an x and y axes that identify the centre of the window. Your program will prompt the user for values that define a circle and a line in this coordinate system and draw them. Finally, your program will perform calculations to determine whether the line and circle intersect. At each of the points where the line intersects the circle, you will draw a small circle to indicate the intersection point.

You can think of this assignment as a series of stages to complete. First, you import some libraries. Next, you define constants (all upper case) that replace magic numbers. Some of these are obvious like the window size. You will likely identify more constants as you write the rest of the program. Then setup your window and carry out the rest of the assignment requirements. This code should get you started.

End your program with screen.exitonclick() so that the window stays open until it is clicked on. With your window ready, draw your axis. This axis should cross through the middle point of the screen, i.e. (400,300). Remember to use your constants here, and later.

Then prompt the user for input, cast it to the proper type, and store it in variables. Remember to use descriptive variable names. For this assignment, it is sufficient to adopt the same variable names used in the mathematical equations below.
Draw your circle and your line.

Calculate the number of intersection points between the circle and line. Then, produce a conditional statement that lets you display a message indicating the number of intersection points to the user.

Calculate the location of each interaction point (if any) and draw a circle around it.

Drawing in Turtle:
You can imagine the turtle drawing system as a turtle carrying a pen. The turtle starts in some default location within the window and has its pen pressed down and ready to draw. To draw a line from the turtle's location to a new point, tell the turtle to move to the new location. It will drag the pen along as it moves to the new location effectively drawing a line. If you tell the turtle to lift up the pen, then tell it to move to a new point, it will go to this new point without drawing the line.

For this assignment, you must know how to position the turtle in a specific location (a point in the coordinate system, also known as pixel location), how to start and stop drawing, and how to change drawing colours. Draw the axis in black, the circle in red, the line in blue, and the intersect/text in green.

You can use the circle command to draw the circle. The circle command, by default, draws circles from the middle of the bottom edge. Therefore, to draw a circle around a centre point, you must determine where the proper start location is (hint: adjust from the centre using the radius). (If you turn your pointer [turtle], then because the circle starting point is to the left of the turtle this will change how your circle is drawn.

Getting Input:
Read the input from the user using the techniques that we have discussed in class. Display a prompt in the terminal window with a print statement, or by providing a parameter to the input function. Note that the user will enter their input in the terminal window, not in the graphics window.

Attachment:- Analytical Geometry.rar

Reference no: EM133002370

Questions Cloud

Influences of micro and macro environmental factors : Develop an understanding and appreciation about the influences of micro and macro environmental factors and forces that affect an organisation's ability
Calculate the book value on the december balance sheet : Three different companies each purchased trucks on January 1, Year 1, for $50,000. Calculate the book value on the December balance sheet
Calculate the cost per equivalent unit for labor : Calculate the cost per equivalent unit for labor, assuming that labor is added uniformly throughout the production process
Prepare the full cash flow statement for vwx corp : Prepare the full cash flow statement for VWX Corp. for the year ended December 31, 2016 using the indirect method
Calculate the number of intersection points : Calculate the number of intersection points between the circle and line. Then, produce a conditional statement that lets you display a message indicating
Research paper for information resources technology : Research paper for Information Resources Technology - Difference or similarities to Director of Information Technology or Director of Computer Services.
Prepare a bank reconciliation for music-is-us for december : Accrued income taxes payable for the entire year ending December 31, 2021, total $81,000. Prepare a bank reconciliation for Music-Is-Us for December
How much do dexter and molly need to deposit into account : How much do Dexter and Molly need to deposit into the account at the end of each of the next 35 years to accomplish their goals?
Determine the material price variance : During May, 2021, actual factory overhead total P14,820 and 4,940 labor hours cost P37,050. Determine the Material price variance

Reviews

Write a Review

Other Subject Questions & Answers

  Which principle of learning to do you demonstrated

Which principle of learning to do you demonstrated in your own classes? In what ways might you bring other principles into them? The response must be typed.

  What you found most challenging about apa style

Explain what you found most challenging about APA style, and how you overcame that challenge. Describe resources available to the student that can be.

  What is market structure and what is porter five forces

What is market structure and what is Porter's Five Forces? Here is some help. One way to measure the type of market is an index know as the Herfindahl.

  Select a highly publicized and describe it

Describe the issue, its importance to stakeholders, its outcome, and/or any development expected in the near future.

  Feelings of low self-worth among lower-class individuals

In what respect do you agree or disagree with the instructor's assertion about the negative effects of capitalism on human relations.

  Which specific aspect do you think had the biggest impact

Explain how this area aligns with the research by incorporating information from at least two academic sources to support your statements and ideas. Academic sources could include your textbook, required readings for this module, or academic journ..

  Strategic frameworks for media products

Your textbook discussed several strategic frameworks for media products, a few of which are listed below. For this assignment, choose two strategic frameworks from the list, and for each framework, find a scholarly (peer-reviewed) journal article ..

  Encourage language development

What are some concepts of print that are used in your classroom? How do you encourage language development?

  Parallel implementations - program for a pizza shop

Parallel Implementations - program for a pizza shop - creating the same application in the given programming languages

  Why are some executive orders controversial

What are executive orders and upon what powers are they based? Why are some executive orders controversial?

  Find a business job online

Find a business job online that you would realistically apply to, either for an internship now, or for a full-time position upon graduating

  Discuss the concept of systems perspective and social change

.Discuss the concept of Systems Perspective and Social Changes. Discussion in which you explain how multiple systems interact to impact individuals

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd