Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Writea C program that calculates fractions. Here is a typical usage FRACTION CALCULATOR x:3/4 y 12/5 > # multiply > z=x*y > # print z
Writea C program that calculates fractions. Here is a typical usage FRACTION CALCULATOR x:3/4 y 12/5 > # multiply > z=x*y > # print z to get 9/5 9/5 x:6/5 > y=x+2 >#add to get 3 3 >#quit GOODBYE The program prints a title then prompts (using '>') for user's instructions. The types of instructions are as follows Set, of the form: variable- fraction. Assignment, of the form variable- variable operator variable. Print, of the form: variable. Comment, of the form: # comment Quit, of the form q. A variable is one of: x, y or z. Operator is one of:- * /. Functions: You must use functions to input and output fractions, and to add, subtract, multiply and divide fractions To ensure all fractions are reduced you must use a "ged" function. Fractions will be represented by 2 integers: one for the numerator and one for the denominator. you must use style #2 for the placement of functions, ie prototypes, followed by main, followed by functions. (Even if you know strings or arrays, you must not use theml). Testing: Run each of these 5 test cases: include a comment in your instructions, eg: # Test Case #1 #1: See the above typical usage. #2: Calculate 17/10+11/20, 5/2-13/10, 15/39* 9/55 and (32/7) / (16/7) #3: Calculate 1/4 + 1/18 + 1/468 and 1/8 + 1/78 + I/9048 #4: Calculate (.(1/2+ 3/4) * (6/5-7/8)) / ( 9/10+ 11/12 ) #5: Demonstrate any special additional features. Include comments to explain
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