Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The World Wide Web And Databases International Workshop Webdb 98 Valencia Spain March 27 28 1998 Selected Papers Lncs 1590

Authors: Paolo Atzeni ,Alberto Mendelzon ,Giansalvatore Mecca

1st Edition

3540658904, 978-3540658900

More Books

Students also viewed these Databases questions

Question

What is an NGO?

Answered: 1 week ago

Question

The neurons of the spinal cord are part of the nervous system.

Answered: 1 week ago

Question

2. Are you varying your pitch (to avoid being monotonous)?

Answered: 1 week ago

Question

3. Are you varying your speaking rate and volume?

Answered: 1 week ago