Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do all the steps COP 2220 FALL 2018 Small Program 4 (prog4.c) steps: *Please do only one step at a time and do not

Please do all the steps image text in transcribed
image text in transcribed
image text in transcribed
COP 2220 FALL 2018 Small Program 4 (prog4.c) steps: *Please do only one step at a time and do not move onto the next step until you have compiled and tested the current step: Read the assignment instructions 2. 1. Create an empty project, add the source code file and Copy and paste the prog4.c template 3. Change the header comment so that it has your name, date, and a description of the program build run and test, the outline code should compile and execute 4 The first function you will implement will be the Greeting function . Create the function definition (block of code)below the main function Inside this function use printf statements to display your Greeting message to the user build run and test 5. Now it is time to test the Greeting function with a function call . Write the statement to call the greeting function from inside the main function build run and test 7. The next function we will implement is the Getlnt function . Remove the comments from the function prototype . Create the function definition below the main function .Inside this function you will need to declare an integer . Ask and get the integer from the user .Return the integer build run and test 8. Now it is time to test the Getint function with a function call 9. Declare an integer in the main function 10. Write the statement to call the Gctint function from inside the main function 11. Use a printf statement to display the integer that was retuned from the GetInt function call build run and test 12. Repeat steps 8 through 11 3 more times for a total of 4 integer values build run and test 13. The next function we will implement is the FindabsoluteValue function . Remove the comments from the function prototype - Create the function definition below the main function Inside this function you will need to declare an integer for the result .Use the abs function from the stdlib to calculate the absolue value of argl-arg .Use an assignment statement to assign the result to the declared integer Return the result build run and test 14. Now it is time to test the FindAbsoluteValue function with a function call 15. Declare an integer in the main function to store the result that is returned from the function l6. Write the statement to call the FindAbsoluteValue function from inside the main function 17. You will need to pass 2 integers to the function and use an assignment statement to capture the integer that is returned 18. Use a printf statement to display the integer that was retumed from the FindAbsoluteValue function call build run and test 19. Repeat steps 14 through 17 for the second absolute value calculation build run and test 20. The next function we will implement is the GetDouble function 21. This function is very similar the Getint only it will be done with a double (SEE steps 12) build run and test 22. The next function we will implement is the FindQuo function Remove the comments from the function prototype e Create the function definition below the main funetion Inside this function you will need to declare a double for the result of argl/arg2 You will need to use an if or if else combination to avoid dividing by zero Retum the result build run and test 23. Now it is time to test the FindQuo function with a function call 24. Declare a double in the main function to store the result that is returned from the function 25. Write the statement to call the FindQuo function from inside the main functio 26. You will need to pass 2 doables to the function and use an assignment statement to capture the double that is rcturned 27. Use a printf statement to display the double that was returned from the FindQuo function call build run and test 28. Repeat steps 23 through 27 for the second quotient calculation build run and test BEFORE SUBMITTING THE CODE Intro to Programming in C-small program4 Project objective: To compile, build, and execute an interactive program with user defined functions. Submit source code (prog4.c) through Canvas . One source code file (unformatted text) will be submited The file name must match the assignment . The code should be tested and run on a Microsoft compiler before it is uploaded onto Canvas . The code must be submitted on time in order to receive credit (11:59 PM on the due date) Late submissions will not be accepted or graded * All programming assignments are individal work, sharing code is considered cheating You will need to use functions from: Rincludecstdio.h> f/printf, scanf Rincludecstdlib.h> //absolute value /EXAMPLE:result-abs(numberi- number2) Program 4, functions: Create an interactive program using 3 user-defined functions. Greet the user void Greeting)i .Get 4 integers from the user int GetIntO; Find the absolute value of the difference of the first integer and the second integer Print the result onto the scroen Find the absolute value of the difference of the third integer and the fourth integer Print the result onto the screen .Get 4 doubles from the user double GetDoubleO * Calculate the quotient of the first double divided by the second double DO NOT ALLOW DIVIDE BY ZERO Print the result onto the screen * Calculate the quotient of the third double divided by the fourth double DO NOT ALLOW DIVIDE BY ZERO Print the result onto the screen create and implement 2 additional functions: //calculates and returns the absolute value /fof the difference of 2 integers int FindAbsoluteValue(int argl, int arg2)): //calculates and returns the quotient of //argunent one divided by argunent 2 /Idoes not allow division by 8, the function will return e.e if the denominator has a e value double FindQuo(double argi, double arg2)

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

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

1.who the father of Ayurveda? 2. Who the father of taxonomy?

Answered: 1 week ago

Question

Commen Name with scientific name Tiger - Wolf- Lion- Cat- Dog-

Answered: 1 week ago