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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education