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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 14:40, coryowens44
For this assignment you have to write a c program that will take an infix expression as input and display the postfix expression of the input. after converting to the postfix expression, the program should evaluate the expression from the postfix and display the result. what should you submit? write all the code in a single file and upload the .c file. compliance with rules: ucf golden rules apply towards this assignment and submission. assignment rules mentioned in syllabus, are also applied in this submission. the ta and instructor can call any students for explaining any part of the code in order to better assess your authorship and for further clarification if needed. problem: we as humans write math expression in infix notation, e. g. 5 + 2 (the operators are written in-between the operands). in computer's language, however, it is preferred to have the operators on the right side of the operands, ie. 5 2 +. for more complex expressions that include parenthesis and multiple operators, a compiler has to convert the expression into postfix first and then evaluate the resulting postfix write a program that takes an "infix" expression as input, uses stacks to convert it into postfix expression, and finally evaluates it. it must support the following operations: + - / * ^ % ( example infix expression: (7-3)/(2+2) postfix expression: 7 3 2 2 result: rubric: 1) if code does not compile in eustis server: 0. 2) checking the balance of the parenthesis: 2 points 3) incorrect postfix expression per test case: -2 points 4) correct postfix but incorrect evaluation per test case: -i points 5) handling single digit inputs: maximum 11 points 6) handling two-digit inputs: 100 percent (if pass all test cases)
Answers: 3
image
Computers and Technology, 22.06.2019 19:30, Jbutler15
When creating a presentation in libre office impress, where does the editing of slides take place?
Answers: 1
image
Computers and Technology, 22.06.2019 22:30, juliangarcia0002
Which of the following factors would your hypothetical supervisor look at when deciding whether to test a biological material sample for dna? the amount of other evidence you have implicating a suspect in a crime the annual budget for the crime lab both of the above none of the above; you would almost always order a test
Answers: 3
image
Computers and Technology, 22.06.2019 23:30, Arealbot
To check spelling errors in a document, the word application uses the to determine appropriate spelling. internet built-in dictionary user-defined words other text in the document
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 in other subjects:

Konu
French, 30.08.2019 15:10