Question
Develop an algorithm and a C program that obtains X and Y coordinates from the user and then displays a message telling the user where
Develop an algorithm and a C program that obtains X and Y coordinates from the user and then displays a message telling the user where the point lies on the Cartesian plane:
on the x axis, or
on the y axis, or
in quadrant 1, or
in quadrant 2, or
in quadrant 3, or
in quadrant 4, or
at the origin.
Interaction with the user might look something like this: This program gives you info about where a points lies on the Cartesian plane. Please enter an integer for the X coordinate: 7 Please enter an integer for the Y coordinate: -8 The point 7 / -8 lies in Quadrant 4 Thanks for using my program.
Here are some additional requirements:
a programmer-created function (PCF) named greet ( ) will communicate the purpose of the program to the user
greet( ) shall be called from main( )
a programmer-created function (PCF) named get_x ( ) will obtain the X coordinate from the user
get_x( ) shall be called from main( )
a programmer-created function (PCF) named get_y ( ) will obtain the Y coordinate from the user
get_y( ) shall be called from main( )
a programmer-created function (PCF) named determine_pt ( ) will determine the location of the point on the Cartesian plane and communicate a one-character "code" back to the calling environment (you determine the scheme of the "code")
determine_pt( ) shall be called from main( )
the decision logic to determine the location of the point shall be included as part of the comments for determine_pt( )
you must use if / else if / else construction to implement your decision logic for determine_pt( )
a programmer-created function (PCF) named display_result( ) will take the one-character "code" and display and it will display a single message to the screen that informs the user of the location of the point
display_result( ) shall be called from main( )
the decision logic to determine the single message that is displayed (based on your "code" scheme) shall be included as part of the comments for display_result( )
you must use switch/case construction to implement your decision logic for display_result( )
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started