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

  Create class has constructor to reduce function of fraction

Create a class RationalNumber (fractions) with the following functionality: Has a constructor that prevents a 0 denominator in a fraction and calls the reduce function to simplify the fraction

  Explaining box properties available in css

Browse the Web and choose a site that could benefit from box properties available in CSS. Make a screen capture of the page and indicate how you would change border and spacing properties.

  Write program to take as input salesperson-s expected sales

Write program to take as input the salesperson's expected weekly sales and outputs the wages paid under each plan as well as announcing the best-paying plan.

  Write program to allow two users to play tic-tac-toe

Write a program that will allow two users to play tic-tac-toe. The program should ask for moves alternately from player X and player O.

  Write program that asks user for initial

Write a program that asks a user for his/her first initial. Then ask the user to type 1,2 3, 4. When the user types 4 the program ends. When the user types in 1, 2, or 3 , the program displays the message.

  Program to return the array index having largest savings

Write down function also called from main module - this function will find out and return array index containing the largest savings.

  Write program to compute total payment

Write a program that computes the total payment, tip, and tax for the "ABC" restaurant. This program must have three functions as below: Menu (Show the menu for each customer). Menu include 6 options.

  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?

  Explaining steps to execute branch instruction

Sketch a flow chart which carefully explains steps that little man follows to execute a branch instruction.

  Design program to ecode message using caesar cypher

Design a program which decodes messages. Messages will be encoded using Caesar cypher, with each letter being decoded by replacing it with previous letter in alphabet.

  Write program to accept number from user-fibonacci series

Write a program that accepts a number 'n' from the user and generates Fibonacci series till n (Fibonacci series starts with 0 and 1.

  Use two-dimensional array in javascript to solve problem

Using javascript. Use a two-dimensional array to solve the following problem: A company has four salespeople (1 to 4) who sell five different products (1 to 5).

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