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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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