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 18:30
Which of the following is an example of intellectual properly! oa. new version of a novelb. journal of ideasc. pages of a bookood. lines of a poem
Answers: 2
question
Computers and Technology, 23.06.2019 23:30
A. in packet tracer, only the server-pt device can act as a server. desktop or laptop pcs cannot act as a server. based on your studies so far, explain the client-server model.
Answers: 2
question
Computers and Technology, 23.06.2019 23:40
Which of the following calculates the total from the adjacent cell through the first nonnumeric cell by default, using the sum function in its formula? -average -autosum -counta -max
Answers: 1
question
Computers and Technology, 24.06.2019 07:00
Selective is defined as paying attention to messages that are consistent with one’s attitudes and beliefs and ignoring messages that are inconsistent.
Answers: 1
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
question
History, 23.07.2019 08:20
Questions on the website: 13722362