Question: This assignment will be in two parts, resulting in several source code files. Do part 1 first, and then do part 2 . Part 1

This assignment will be in two parts, resulting in several source code files. Do part 1 first, and then do part 2.
Part 1- Building a calculator
The purpose of part 1 is to build a "calculator" in C using functions. In particular, I want you to build a calculator with the following functions:
int getNumber()- This function gets a number from the user and returns it.
int getOperator()- This function get an operator (character) from the user and returns it.
int power(int x, int y)- This function raises x to the power of y (i.e., x^y)
int bottom(int x, int y)- This function returns the floor of the x floor y (floor returns the nearest integer value which is less than or equal to the floating point number of x / y)
int rounded(int x, int y)- This returns the closes integer to x / y (either larger or smaller)
Note: Your main() should call getNumber() twice to get the two numbers, then call getOperator(), run the value returned by getOperator() through a switch statement, and then call the appropriate function. You should print out the equation and the result. This should be in a loop so that you can enter numbers and call functions until the user chooses to exit.
Part 2- Build a module for your calculator.
Once you have completed Part 1, modify your code so that:
all of the functions are now in a .c file called
all of the function definitions are in a .h file called
Keep the main program from Part 1, but remove the functions.
Make sure your code runs when compiled with the appropriate .h file.
Deliverables:
Put Part 1 and Part 2 in two different folders, both of which are in a folder that is appropriately named as per the assignment submission instructions. Each part should have its own Makefile that does the appropriate compilation. Note that for Part 2, the .o file for the file should be generated on the first compile, but shouldn't be regenerated with subsequent compiles unless needed.
Upload as a .tgz file.
PLEASE NOTE: Several people have contacted me because their assignment uploads as .tgz files were "empty". You should be checking your .tgz files before you upload them to make sure that they worked.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!