Create a class for working with mixed fractions

Assignment Help Programming Languages
Reference no: EM131266332

Program:

Create a class for working with mixed fractions. Only 3 private data members are needed: the int whole number part of the fraction, the int numerator of the fraction, and the positive int denominator of the fraction. For example, the fraction 3 5/8 will have the three private data member values of 3, 5, and 8. The following methods should be in your class:

a. A default constructor that should use default arguments in case no initializers are included in the main. The fraction needs to be stored in reduced form. Make sure the denominator is not set to 0 or a negative value.

b. Add two mixed fractions and store the sum in reduced form.

c. Subtract two mixed fractions and store the difference in reduced form.

d. Multiply two mixed fractions and store the product in reduced form.

e. Divide two mixed fractions and store the quotient in reduced form

f. Print a mixed fraction.

g. Change a fraction to its reciprocal. For example, the reciprocal of the fraction 3 5/8 is 8/29. The reciprocal of 4/19 is 4 3/4.

Your main should instantiate two mixed fractions and call each of the class methods. The two mixed fractions should be printed along with the sum, difference, product, quotient, and after being changed to its reciprocal. (Please do not overload the operators for this program.)

Reference no: EM131266332

Questions Cloud

Do you think these biases are a problem in the real world : In your reading for this week, you learned that that people have systematic and predictable biases that influence their judgment. Do you think these biases are a problem in the "real world?" Is there anything we could do to rectify it?
How bad faith relate to epistemic and ontological closure : What is bad faith? How does bad faith relate to epistemic and ontological closure? What are epistemic and ontological closure? How does bad faith manifest itself in how people are represented in advertizing?
Explain why the issue poses a problem or concern : Describe the issue, being sure to identify the relevant age and/or grade levels. Explain why the issue poses a problem or concern, being sure to address human development and cognitive processes. Discuss at least one innovative teaching and/or learn..
What changes would be required to job designs : What changes would be required to job designs in order to implement your suggested strategies for eliminating the inefficiencies. How the way people are measured might need to be adjusted as a result of your suggestions.
Create a class for working with mixed fractions : Create a class for working with mixed fractions. Only 3 private data members are needed: the int whole number part of the fraction, the int numerator of the fraction, and the positive int denominator of the fraction
What is the optimal mix : (i) What is the optimal mix? (ii) What is the firm's output elasticity and returns to scale? Explain.
Identify an internal process you wish to evaluate : Identify an internal process you wish to evaluate. Select an appropriate design approach for the chosen process. Create a high-level AS IS process flow chart using an appropriate design tool.
What is the most important thing you learned : In two complete pages, what is the most important thing you learned in this course and how can you carry this knowledge forward into your career in education?
Supporting innovation processes : In what ways is the management of the Dr Pepper Snapple Group seeking and supporting innovation processes within the firm? Do you think that their approach is appropriate for their industry and market? Why or why not?

Reviews

Write a Review

Programming Languages Questions & Answers

  Difference between the 2 graphics

It is the business that has the knowledge about their entities (things of importance) and what kind of unique information that separate them (invoice numbers, customer IDs, and so on).

  Recursive method to read in string of characters

Trying to write a recursive method that reads in a string of characters and checks to see if the first character is either a 'D' or and 'E', then is followed by a string of one or more 'F's.

  Explain modular concepts incorporated in program logic

The title of the report is Kyles Transportation Company and could you also please do the code for the report so that the program will run in Qbasic or Microsoft QuickBASIC

  Write program that computes loan payments

Write a program that computes loan payments. The loan can be a car loan, a student loan, or a home mortgage loan. The program lets the user enter the interest rate.

  Program to do multiplications using divide-and-conquer

Recall that xy = (xy/2)2 if y is even. Use this to write down the function which calculates xy, suppose that y is a power of 2.

  Identify why the two tests fail and correct the code

Your first task in this assignment is to study the given code, identify why the two tests fail, and correct the code.

  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.

  Html5 browsers will support the following new technology

HTML5 browsers will support the following new technology. o CSS 2 o PDF 10.2

  Write program for department of motor vehicles

Department of motor vehicles has finally decided to computerize its list of licensed drivers. Program you write must make use of existing file call Licenses with records of given form. Name, License Number

  Pseudocode to read in data file containing student names

Read in a data file containing student names, ID number, and gender into an array. Print the contents of each record using the array.

  Write a program to go through your address book

Everyone has at least one friend who always remembers everyone's birthday. Write a program to go through your address book and print the names and phone numbers of all people who have birthdays on that day, so you can give them a call.

  C++ program for bus reservation system

C++ program for bus reservation System that show the number of seat availability , arrival & depart time , bus number etc

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