Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 Please Python language for solution You are to write a program that asks where a line crosses the X-axis and the Y-axis. You

image text in transcribedimage text in transcribed

Question 1 Please Python language for solution You are to write a program that asks where a line crosses the X-axis and the Y-axis. You may assume that when the user correctly types in a number it is an integer but you should check that it is a valid input. The equation of the line is: a Bx + Ay = C. Note . A = where the line crosses the X-axis B = where the line crosses the Y-axis C = AB To be clear, make sure the following happens: 1. If the user types in a silly input like "asdgdsafd" the program should say that is not valid. 2. If the user enters 0 and 0 for the X- and Y-axis intercepts then the program should say that it is not valid i.e. "Sorry, I need two points." 3. If the user enters 0 for the X-axis intercept, then it should say something like "That is just the Y-axis i.e. x=0. Give me non-zero integers please :)" and likewise if the user enters 0 for the Y-axis intercept. 4. Once the user enters two integers which are non-zero then the equation of the line should be found and printed. The output should be clear e.g. no +-" or "1x" in the output. 5. Finally, the program should repeat unless the user quits. An example of the program in action is shown on the next page, this is to help aid you in writing your code. Read it carefully and make sure your program at least can reproduce it. # # # Tell me where your line crosses the X and Y axis. Values must be integers. # # # Where does your line cross the X-axis? 8 Where does your line cross the Y-axis? Sorry, I need two points. # # # Tell me where your line crosses the X and Y axis. Values must be integers. : : : Where does your line cross the X-axis? 1 Where does your line cross the Y-axis? 0 That is just the X-axis i.e. y=0 Give me non-zero integers please :) : : . Tell me where your line crosses the X and Y axis. Values must be integers. : : : Where does your line cross the X-axis? sdaf Sorry, that is not a number # 3 : Tell me where your line crosses the X and Y axis. Values must be integers. ! ! ! Where does your line cross the X-axis? 2 Where does your line cross the Y-axis? 3 Thank you. I will find the equation of the line. line: 3x+2y=6 Quit? y: n = = = Tell me where your line crosses the X and Y axis. Values must be integers. = = = Where does your line cross the X-axis? 4 Where does your line cross the Y-axis? 8 Thank you. I will find the equation of the line. line: 2x+y=8 Quit? y: n # 3 : Tell me where your line crosses the X and Y axis. Values must be integers. : : : Where does your line cross the X-axis? 8 Where does your line cross the Y-axis? 4 Thank you. I will find the equation of the line. line: x+2y=8 Quit? y: # ! : Tell me where your line crosses the X and Y axis. Values must be integers. ! :: Where does your line cross the X-axis? -4 Where does your line cross the Y-axis? 8 Thank you. I will find the equation of the line. line: -2x+y=8 Quit? y: y Goodbye

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions