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

  Clarification may be offered to clear up that confusion

Why do people confuse the World Wide Web with the Internet. What clarification could be offered to clear up that confusion.

  What would be your reaction to the given problem

One of your committee members has just learned that a particular system has blown out the competition in the SPEC CPU2000 benchmarks. He is now insisting that the committee buy one of these systems. What would be your reaction to this?

  Valuate user dialog strategies used by menu-driven interface

Evaluate the user dialog strategies used by a menu-driven interface. Determine why menu-driven interfaces continue to be popular in the modern computing age.

  Assume that you are a software engineer working on a fixed

imagine you are a software engineer working on a fixed budget and you are tasked to develop a web-based student

  Develop the requirements definition for the amazon site

Review the Amazon.com Web site. Develop the requirements definition for the site. Create a list of functional business requirements that the system meets.

  Software measurement and software metrics

Explain whether the software measurement is equivalent to the software metrics? What makes them different? Explain the common software metrics which you already know, heard about or used?

  What do you mean by wimax describe why mobile wimax is an

directions please provide detailed and elaborate responses to the following questions. your responses should include

  What are values of sum1 and sum2

If the operands in expressions are evaluated left to right. If the operands in the expressions are evaluated right to left? Sum1=48, Sum2=46

  What is the word describe sql

what is the word describe SQL

  Questionstructured and unstructured databest practices in

questionstructured and unstructured databest practices in it change frequently to address new problems and to simplify

  Select a current computer-crime trendwrite a 1400- to

select a current computer-crime trend.write a 1400- to 1750-word paper that describes a cybercrime trend that society

  What would be the mappings between cache block

take a memory of 64 blocks (labeled 0 through 63) and a cache of 16 blocks (labeled 0 through 15). In the questions below, list only correct results.

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