Question: Write a program in Java and run it in BlueJ according to the following specifications The user enters two fractions each one specified as two
Write a program in Java and run it in BlueJ according to the following specifications The user enters two fractions each one specified as two integers: a numerator and a denominator . Then the program adds, subtracts, multiplies and divides the fractions (without simplification) and prints the result as a fraction, a mixed number, and as a decimal (floating point) number Example: If the fractions entered are 1/2 and 3/4 the program input and output should look exactly as the following (user input is shown in bold): Enter numerator: 1 Enter denominator: 2 Enter numerator: 3 Enter denominator:4 Result as fraction and mixed number 1/2 +3/4 -10/81 2/8 /2 3/4-2/8 0-2/ 1/2 3/4 -3/80 3/8 112 3/4-4/6-0 4/6 Result as floating point number 0.5 0.75 1.25 0.5 0.750.25 0.5 * 0.75-0.375 0.5 0.75- 0.6666667 Requirements and restrictions (each of the items below will be graded): 1. Use the scanner class for input 2. Use proper names for the variables suggesting their purpose. 3. Use float type for the floating point variables 4. Format your code accordingly using proper indentation, alignment and spacing 5. Use multiple I ne nment in the beginning of the code and write your name, e-mail address, class, and section 6. For each statement in the code add a comment to explain its meaning in the program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
