Question
Java I: Scanner Class Create a Java program that will prompt the user for a numerator and a denominator of a fraction, and return a
Java I: Scanner Class
Create a Java program that will prompt the user for a numerator and a denominator of a fraction, and return a decimal equivalent of that fraction by dividing the numerator by the denominator. Output should meet the output format given below.
Structure your file name and class name on the following pattern:
The first three letters of your last name (begin with upper case.).
Then the first two letters of your first name (begin with upper case.).
Follow this with the name of the program: Fraction.
For a student called John Doe, the class name and file name would be: DoeJoFraction
3.1. Specifications
Name the program Fraction and format the title as described above by incorporating your name.
Use good comments:
Write a good description of what the program does. I will start grading that as a part of the program. This part is much more important than you might first think. Programmers revise a lot of code and it is important that they (and you) can quickly read important points in the description and other comments, to get a clear idea of how the code works.
Use comments within the code as well, especially on calculations and other areas that might need some explanation.
Think about the problem and decide what type each of the input numbers should be. Also, think about the calculations and decide what type the variables should be that will hold the results of the calculations.
Use camel casing for variable names, and use descriptive variable names. This time I will take points off for variable names like "tax" or "total."
Prompt the user with a statement asking for the input of the numerator, and a second prompt asking for the denominator. Clearly express in your prompt, what the user is to enter.
Label all output to match the Output Format section below.
3.2. Output Format
Format the output to look similar to the following:
The 9s just indicate where numbers will be. There may be more digits than the single 9.
***** Decimal Equivalent *****
The numerator is: 9
The denominator is: 9
The original fraction was: 9/9
The decimal equivalent is: 9.9
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started