Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Also, you can leave the URL of your Javadoc as a comment in the code. - 0.5 ptProvide documentation comments for both parts. - 0.5

Write a program that reads two times in military format (hhmm) from the user and prints the number of hours Also, you can leave the URL of your Javadoc as a comment in the code.
- 0.5 pt Provide documentation comments for both parts.
- 0.5 pt Generate Javadoc API documentation and post it on a website (not just locally!
Must be accessible to other people, can use GitHub ).
- 1 pt Test writePrimes or printTimeDifference using Junit test.

Write a program that reads two times in military format (hhmm) from the user and prints the number of hours and minutes between the two times. If the first time is later than the second time, assume the second time is the next day. Remember to take care of invalid user inputs, that is, your program should not crash because of invalid user input. Hint: take advantage of the printTime Difference method you wrote in Assignment 1. You can either update that method so it will do the input validation or do the validation before calling the method. Examples These are just examples. You can have a different design as long as it's reasonable. For example, you can ask the user to enter 2 times in one line, separated by a comma; or you can have different print out messages for invalid input; or you can ask the user to re-enter instead of terminating the program; etc. User input is italic and in color. Example 1 Please enter the first time: 0900 Please enter the second time: 1730 8 hour(s) 30 minute(s) Example 2 (invalid input) Please enter the first time: haha Invalid input! Program terminated! Grading +1 pt your program takes user input and works for valid user inputs +1 pt your program won't crash due to invalid user inputs +1 pt your program treats different kinds of invalid inputs accordingly + up to 1 pt (extra credit): your program is well-designed and exceeds my expectations. (For the above, think of something like an interface, or any interesting modification that shows effectiveness or entertains).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Sure here is a Python program that reads two times in military format hhmm from the user and prints the number of hours and minutes between the two ti... 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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Accounting questions