Computers and Technology

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.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 20:40, cmflores3245
Convert and simplify the following sentences to conjunctive normal form (cnf): (a) (p β†’ (q β†’ r)) β†’ (p β†’ (r β†’ q)) (b) (p ∧ q) β†’ (Β¬p ↔ q) (c) ((p β†’ q) ∧ Β¬q) β†’ Β¬p
Answers: 3
image
Computers and Technology, 22.06.2019 14:30, SKYBLUE1015
What percentage of companies is projected to use social media to locate new employees in 2012
Answers: 2
image
Computers and Technology, 23.06.2019 12:40, melaniem50
Curriculum exam to process a resident's payment, you must click on onesite payments home page. from the a. reports b. my settings o c. transactions o d. rent tab
Answers: 1
image
Computers and Technology, 25.06.2019 00:00, nisha87
Rom is designed for computer instructions temporary storage of data processing data
Answers: 1
Do you know the correct answer?
Your assignment is to write a class for fractions and a driver to verify it works. Your main functio...

Questions in other subjects: