subject

Your assignment is to write a class for fractions and a driver to verify it works. Your main function will be your test driver, it will input two fractions from the user (via the keyboard).It must then add them, subtract them, multiply them, divide them, and test if they are equal or not, test if one is greater than the other or not and display this information to the user. It will then ask the user if there is another set of fractions to work with, and if yes do the same for them. It will continue to do this until the user responds that there are no more fractions to work with. Note that the driver should first call the simplify method described below to simplify any fractions that are not in their simplest form. The class must have: Two private variables, the numerator and denominator (of type int).The following public methods:• A default constructor (sets the numerator to 0 and the denominator both to 1).• A constructor that takes the numerator and denominator as inputs.• A setter for the numerator.• A setter for the denominator.• A getter for the numerator.• A getter for the denominator.• A type Fraction method to add two fractions.• A type Fraction method to subtract two fractions.• A type Fraction method to multiply two fractions.• A type Fraction method to divide two fractions.• A type Fraction method to simplify a fraction, that is put it in its simplest state.• A type boolean method to check if two fractions are equal.• A type Boolean method named isBigger that compares two fractions and returns true or false.• A toString method that returns a string representing the fraction in the form a/b, where a and b are then numerator and denominator. Use this to display your output.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 09:00
Create a cell reference in a formula by typing in the cell name or         a. right-clicking the cell. b. clicking the cell. c. clicking the column where the cell is located. d. clicking the row where the cell is located.
Answers: 1
question
Computers and Technology, 22.06.2019 11:00
Which law requires employers to provide safe working environments for their employees? a. civil rights act b. fair labor standards act c. occupational safety and health act d. wagner act
Answers: 1
question
Computers and Technology, 22.06.2019 16:30
What type of file does a cookie place on web site visitors' computers so that web site managers can customize their sites to their visitors' preferences?
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
What is the worst-case complexity of the maxrepeats function? assume that the longest string in the names array is at most 25 characters wide (i.e., string comparison can be treated as o( class namecounter { private: int* counts; int nc; string* names; int nn; public: namecounter (int ncounts, int nnames); int maxrepeats() const; }; int namecounter: : maxrepeats () { int maxcount = 0; for (int i = 0; i < nc; ++i) { int count = 1; for (int j = i+1; j < nc; ++j) { if (names[i] == names[j]) ++count; } maxcount = max(count, maxcount); } return maxcount; }
Answers: 3
You know the right answer?
Your assignment is to write a class for fractions and a driver to verify it works. Your main functio...
Questions
Questions on the website: 13722362