Write program to perform arithmetic operations on fractions

Assignment Help Programming Languages
Reference no: EM1363911

Write a program that lets the user perform arithmetic operations on fractions. Fractions are of the form a/b, where a and b are integers and b is not equal to 0. Your program must be menu driven, allowing the user to select the operation (+, -, *, /) and input the numerator and denominator of each fraction. Your program must consist of at least the following functions:

a. Function menu: This function informs the user about the program's purpose, explains how to enter data, and allows the user to select the operation.
b. Function addFractions: This function adds two fractions together (or you can overload the +operator()).
c. Function subtractFractions: This function subtracts one fraction from another (or you can overload the -operator()).
d. Function multiplyFractions: This function multiplies two fractions together (or you can overload the *operator()).
e. Function divideFractions: This function divides one fraction into another (or you can overload the /operator()).

Some sample outputs are:
3 / 4 + 2 / 5 = 23 / 20
2 / 3 * 3 / 5 = 6 / 15

Your answers need not be in the lowest terms.

Reference no: EM1363911

Questions Cloud

Role of financial manager in maximizing shareholder value : Discuss the role of the financial manager in maximizing shareholder value within today's financial markets and what would be the manager's viewpoint vs. an employee or stockholder viewpoint regarding maximizing share value?
Explain what does it mean to be a dynamic manager : Dynamic Managers - How to we balance these to opposing facts, and what does it mean to be a dynamic manager?
Structural issues-differentiation and integration : Discuss the twin structural issues: differentiation and integration. Coordination must be achieved at both the micro- and the macro-levels. Discuss how this relates to the following:
Depreciation-impairments-depletion : You are an accounting tutor. One of your students is confused about impairment because the student has learned earlier that all assets are recorded at their historical cost. The student has the following list of questions for you:
Write program to perform arithmetic operations on fractions : Write a program that lets the user perform arithmetic operations on fractions. Fractions are of the form a/b, where a and b are integers and b is not equal to 0.
Determine annual effective rate earned on investments : A Corporation invests $1,000,000 at the beginning of the year. It adds another $250,000 at the end of 1st quarter, withdraws $350,000 at the end of second quarter,
Define the magnitude of the average force : find out the z-component of the block's momentum after the kick.
Design algorithm to produce list of customers : Design an algorithm to produce a list of customers from the Glad Rags Clothing Company's customer master file. Each record on the customer master file contains the customer's number.
Portfolio management presentation : What are the benefits of portfolio management and How is it being applied - how many organizations are applying the techniques successfully?

Reviews

Write a Review

Programming Languages Questions & Answers

  Program to ask how many games are being purchased

Your program should ask the store clerk how many games are being purchased and calculate a total due (with 6% tax). The total number of games, the discount amount.

  Top-down recursive descent parser

Write a hand-coded top-down recursive descent parser.

  Program for saving account balance report

Savings account balance report from customer savings account file. Every input savings account record contains account number, balance forward, deposits (sum of all deposits).

  Create command line based application for perfect hundred

Create a COMMAND LINE based application to play a game called Perfect Hundred. In this game, the user/player competes against the computer.

  Write program to read integers and finds largest of them

Write a program that reads integer, finds the largest of them, and counts its occurrences. Assume thant the input ends with number 0. suppose that you entered 3 5 3 5 5 5 0.

  Probability line is executed in nth iteration of for loop

What is the probability that line is executed during the nth iteration of the for loop? What is the exact expected number of executions of line?

  Write program to reads student-s name together with score

Write a program that reads a student's name together with his or her test score. The program should then compute the average test score for each student.

  Write program that would estimate magnitude

Write a program that would estimate the magnitude (liters/day) and cost of the water saved based on the community's population.

  Write program to prints the question

Write a program that prints the question"do you want to continue?" and reads a user input. if the user input is"y", "yes", "ok", "sure", or "why not?".

  Determine bowler had highest average and print name

Output the bowlers name, avg. and number of stars earned. Discover which bowler had the highest average and print out their name and average.

  Create nested menus interface for a check-in hotel

Create a nested menus interface for a check-in and check-out hotel reservation system that can be used internationally. Use numbers to select a menu item.

  Design a flowchart displays item-s data

Design a flowchart or pseudocode for the following: displays the item's data only if it is a best-selling item. Best-selling items are those that sell more than 2000 pounds per month.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd