Create a class for working with mixed fractions

Assignment Help Computer Engineering
Reference no: EM131251890

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.

Reference no: EM131251890

Questions Cloud

Town council consists of three members : A town council consists of three members who vote every year on their own salary increases. Two Yes Votes are needed to pass the increase. Each member would like a higher salary, but would like to vote against it herself because that looks good to..
Determine the moment m at the joints d and e : The frame is loaded by a uniformly distributed load with intensity p on the left part DC of the inclined roof. The distributed is acting perpendicular on the beam DC and the intensity p is therefore per inclined length.
Identify a feature length film that fits this genre : Explain genre theory and, using Chapter 4 of the text as a reference, thoroughly describe the conventions and attributes of your selected genre.
Prepare journal entries to record issuance of bonds : Prepare journal entries to record issuance of bonds, interest, straight-line amortization, and balance sheet presentation and balance sheet presentation - Prepare all necessary journal entries to record the issuance of the bonds and bond interest ..
Create a class for working with mixed fractions : 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
Expect the demand for petrol : Why might you expect the demand for petrol to be more elastic in the long run than the short run? Name, with a brief explanation, two other goods that might share this characteristic. (These 'other goods' should not be in the general field of fuel..
Explain the importance of accurate and clear quantification : Provide your answers for these computations in the first paragraph, and attach an Excel file that shows how they were done. Explain the importance of accurate and clear quantification in the second paragraph.
Create an argument map based on the influence diagram : Create an argument map based on the influence diagram and complete all the criteria provided in the exercise, beginning with this claim: "The U.S. should return to the 55- mph speed limit in order to conserve fuel and save lives."
Identify the key roles and responsibilities : Depending on the project scope, one person (project engineer) might be given all of the responsibilities in a given job assignment, or for large programs each role might be assigned to several individuals-do not let these consideration confuse the..

Reviews

Write a Review

Computer Engineering Questions & Answers

  Draw the syntax diagrams for each of grammar elements

Show/Draw the syntax diagrams for each of the grammar elements above. Hyperlink reference not valid. Show the parse trees (which can be generated in ANTLRWorks) for each of the given sentences.

  What is the maximum number of characters

What is the maximum number of characters or symbols that can be represented by Unicode and a color image uses 16 bits to represent a pixel. What is the maximum number of different colors that can be represented?

  How much work you can do per cycle

How fast you can crank up the clock and how much work you can do per cycle

  Generating the crow’s foot erd

Provided the following business scenario, generate a Crow’s Foot ERD utilizing a specialization hierarchy if suitable. Tiny Hospital keeps the information on patients and the hospital rooms.

  As the text describes there are seven 7 steps in the

q1. as the text explains there are seven 7 steps in the program development cycle. identify which of the steps that you

  Noticethatcorporatemanagementhasinthisexampleidentifiedandde

noticethatcorporatemanagementhasinthisexampleidentifiedanddevelopedtheconceptofaswellasdefinedtherequirementstaskmandate

  Find sql statements and screenshots of the result

Any other information you would like to retrieve from the database.

  What is the average memory access time

What is the average memory access time - Draw a pipeline diagram illustrating the first iteration of the loop assuming there are no instruction cache misses. Remember that there are two fetch stages

  Present the business case for technology investments

paper describing how to formulate and present the business case for technology investments

  Question1following two questions are related to congestion

question1.following two questions are related to congestion control in wired networks. let us assume that size of

  Concept of business architecture

You are the CIO of a large international beverage distributor and have been asked to present the concept of business architecture to all division heads in preparation for upcoming implementation.

  What entities would you include on a data model

What entities would you include on a data model? What attributes would you list for each entity? Select an identifier for each entity, if possible.

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