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

  Advantage and one disadvantage of virtual machine approach

Java and many other programming languages have taken approach of executing on a virtual machine, as opposed to compiling to native machine code.

  Write an user defined function to print all the prime number

Write an user defined function to print all the prime numbers within a range.

  Use the library and other quality resources for information

use the library and other quality resources for information about the role of computer forensics and security within

  Create class saving account use a shared class variable to

create class savingaccount. use a shared class variable to store the annualinterestrate for all savingsaccounts. each

  What can be done to enhance the security of business uses

question 1 what can be done to improve the security of business uses of the internet? give several examples of security

  Describe the fetch and execute cycle of a computer

In a paragraph or less, describe the fetch and execute cycle of a computer and what happens during each of the cycles.

  Make a 3-4 page paper not comprising title page and

prepare a 3-4 page paper not including title page and references about 350 words per page comparing and contrasting two

  Write server program act a memory manager

The server program accepts memory requests for each of several clients. A page table is built for each client. The frames assigned to the client are sent hack to the client.

  Questionarrays and control structures are important tools

questionarrays and control structures are important tools while programming. an array contains a number of variables

  Identify industry where it would be appropriate for web page

Identify one industry or condition where it would be appropriate for a web page to play audio automatically. Justify your answer.

  Convert the three hexadecimal numbers to binary

Convert the following three hexadecimal numbers to both binary and decimal. (Hint: it is probably easier to convert hex to binary first, then convert binary to decimal.) Show your work: 3e 3e0 3e00.

  Explain the features and characteristics of atm networks

explain the features and characteristics of ATM networks, as well as their benefits and limitations.

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