Download COP 2250 Laboratory 2 : Java Arithmetic

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
COP 2250
Laboratory 2 : Java Arithmetic
Your Name:____________________________________
Panther-id#:_______________________
Pre-Lab
Create a folder 2250Lab2 on your flash drive. Download the MilitaryTime and Cashier
program-stubs to this folder. Add a customized Program Id Paragraph to each stub.
Program 1: Military Time
Check:____
When completed, this program will prompt the user to enter the time that class ends
and the current time. It calculates the number of minutes remaining until class ends,
and reports the two times and the number of minutes remaining.
It's now 1147. Class ends at 1215.
There are 28 minutes from 1147 until class ends at 1215.
A time is represented in Military Time; a 4-digit integer in which the high digit-pair
represents the hour, 0 to 23, and the low digit-pair represents the minute, 0 to 59. The
indicated algorithm converts both times to minutes after midnight and finds their
difference. For example, Military Time 1215 is 735 minutes after midnight. To do this,
1. Separate Military Time into hour and minute: 1215  12 and 15. Hint: int / and %.
2. Combine hour and minute to get minutes after midnight. Hint: 1 hour = 60 minutes.
Program 2: Cashier
This program prompts the user to enter the cost of an item and the amount tendered
for payment. It displays two output windows:
a) Customer Receipt
Check:____
Cost of Item $11.63
Amount Paid $20.0
Change Due $8.37 : 8 Dollars & 37 Cents
b) Change Details
Check:____
Change Amount $8.37
0 $20 bills
0 $10 bills
1 $5 bills
3 $1 bills
1 Quarters
1 Dimes
0 Nickels
2 Pennies
1. Convert the change to whole cents, and use int / and % to get Dollars and Cents
2. Use / and % to get the numbers of each bill from the Dollars, coins from the Cents
3. Hint: Rounding can eliminate unwanted digits, and correct for a missing cent.
Turn it in
Save this completed checklist along with your program in the 2250Lab2 folder. Zip
the folder and upload the zipped file at https://moodle.cis.fiu.edu/