C language The program should allow users to add, subtract, multiply, and divide fractions. The program should display a menu and prompt the user for a mathematical operation, until they enter 5 to exit. The menu should give the user the option to add, subtract, multiply or divide fractions, or exit. After the user chooses their option, they should be prompted to input two fractions. The result of the arithmetic should then be displayed to the screen.   Requirements main() Functionality: This main function should prompt the user for a menu option until they enter 5. If the user doesn't choose Option 5 to end the program, it should get two fractions from the user. It should decide, based on the menu option which actions to perform on the fractions. Option 1 adds the two fractions together. Option 2 subtracts the first fraction from the second. Option 3 multiplies the two fractions together. Option 4 divides the first fraction by the second one. In addition to the main functions, your program should have 6 more functions: getMenuChoice() Input Parameters: none Returned Output: int Functionality: This function should display to the screen the options available to the user and return the users inputted menu choice. getFraction() Input Parameters: int pointer, int pointer Returned Output: none Functionality: This function should prompt the user to enter a fraction, using the forward slash between the two values. The numerator should be stored into the variable that one of the pointer parameters points to, and the denominator should be stored into the variable that the other pointer parameter points to. addFraction() Input Parameters: int, int, int, int, int pointer, int pointer Returned Output: none Functionality: This function adds two fractions, each represented by a pair of integer input parameters. The resulting fraction should be stored in the variables that the last pair of pointer parameters points to. subtractFraction() Input Parameters: int, int, int, int, int pointer, int pointer Returned Output: none Functionality: This function subtracts two fractions, each represented by a pair of integer input parameters. The resulting fraction should be stored in the variables that the last pair of pointer parameters points to. multiplyFraction() Input Parameters: int, int, int, int, int pointer, int pointer Returned Output: none Functionality: This function multiplies two fractions, each represented by a pair of integer input parameters. The resulting fraction should be stored in the variables that the last pair of pointer parameters points to. dividesFraction() Input Parameters: int, int, int, int, int pointer, int pointer Returned Output: none Functionality: This function divides two fractions, each represented by a pair of integer input parameters. The resulting fraction should be stored in the variables that the last pair of pointer parameters points to.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question

C language

The program should allow users to add, subtract, multiply, and divide fractions.

The program should display a menu and prompt the user for a mathematical operation, until they enter 5 to exit. The menu should give the user the option to add, subtract, multiply or divide fractions, or exit. After the user chooses their option, they should be prompted to input two fractions. The result of the arithmetic should then be displayed to the screen.

 

Requirements

main()
Functionality: This main function should prompt the user for a menu option until they enter 5. If the user doesn't choose Option 5 to end the program, it should get two fractions from the user. It should decide, based on the menu option which actions to perform on the fractions. Option 1 adds the two fractions together. Option 2 subtracts the first fraction from the second. Option 3 multiplies the two fractions together. Option 4 divides the first fraction by the second one.

In addition to the main functions, your program should have 6 more functions:

getMenuChoice()
Input Parameters: none
Returned Output: int
Functionality: This function should display to the screen the options available to the user and return the users inputted menu choice.

getFraction()
Input Parameters: int pointer, int pointer
Returned Output: none
Functionality: This function should prompt the user to enter a fraction, using the forward slash between the two values. The numerator should be stored into the variable that one of the pointer parameters points to, and the denominator should be stored into the variable that the other pointer parameter points to.

addFraction()
Input Parameters: int, int, int, int, int pointer, int pointer
Returned Output: none
Functionality: This function adds two fractions, each represented by a pair of integer input parameters. The resulting fraction should be stored in the variables that the last pair of pointer parameters points to.

subtractFraction()
Input Parameters: int, int, int, int, int pointer, int pointer
Returned Output: none
Functionality: This function subtracts two fractions, each represented by a pair of integer input parameters. The resulting fraction should be stored in the variables that the last pair of pointer parameters points to.

multiplyFraction()
Input Parameters: int, int, int, int, int pointer, int pointer
Returned Output: none
Functionality: This function multiplies two fractions, each represented by a pair of integer input parameters. The resulting fraction should be stored in the variables that the last pair of pointer parameters points to.

dividesFraction()
Input Parameters: int, int, int, int, int pointer, int pointer
Returned Output: none
Functionality: This function divides two fractions, each represented by a pair of integer input parameters. The resulting fraction should be stored in the variables that the last pair of pointer parameters points to.

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning