Question: Lab 2 CISC 1115 Start a new Java program. It should begin by printing, as part of the output (in addition to the comment at
Lab 2 CISC 1115
Start a new Java program. It should begin by printing, as part of the output (in addition to the comment at the beginning of your code, a header for the lab (or homework) that looks like the following:
--------------------------------------------------------------------------
Your name Due Date
CISC 1115 MY11 Lab2
--------------------------------------------------------------------------
Write a program that will read a double from the keyboard, which represents a dollar and cents amount, such as 7325.67, and prints out:
7325.67 is 7 thousand 3 hundred 2 tens 5 dollars and 67 cents
Input of 123 54 would print
123.54 is 0 thousand 1 hundred 2 tens 3 dollars and 54 cents
Or, for input of 100.00 the program will print
100.0 is 0 thousand 1 hundred 0 tens 0 dollars and 0 cents
Input of 12.54 would print
12.54 is 0 thousand 0 hundred 1 tens 2 dollars and 54 cents
Another example,
0.54 is 0 thousand 0 hundred 0 tens 0 dollars and 54 cents
One way to do this is to use casting, integer division and the mod operator (%) as we will discuss in the lecture but feel free to go your own way.
One set of code should work for any amount read in as a double. Assume the input amount is never greater than 99999.99
Print the code and run a number of examples like those above.
Having trouble understanding this, please help. Thank you!!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
