Add a new Java class to your project by right clicking on the src folder in the Project pane and select New > Java Class. Enter Hours as the name for this class, and IntelliJ will add it to the files in the src folder for your project. Remember to copy and insert the standard heading for the main method as you did for Program 2. Write a program that prompts the user to enter a number of hours, and produces the equivalent number of days as a whole number along with the number of hours left over. Assume that a day has exactly 24 hours. The following example shows the format to use for your output, where the input entered by the user is underlined.

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter10: Classes And Objects
Section: Chapter Questions
Problem 2E: Open the Palace Solution.sln file contained in the VB2017\Chap10\Palace Solution folder. Use Windows...
icon
Related questions
Question

Add a new Java class to your project by right clicking on the src folder in the Project pane and select New > Java Class.
Enter Hours as the name for this class, and IntelliJ will add it to the files in the src folder for your project. Remember to
copy and insert the standard heading for the main method as you did for Program 2.
Write a program that prompts the user to enter a number of hours, and produces the equivalent number of days as a whole
number along with the number of hours left over. Assume that a day has exactly 24 hours. The following example shows
the format to use for your output, where the input entered by the user is underlined.
Enter the number of hours: 100
100 hours is 4 days, plus 4 hours.
Define Variables: The number of hours will be a whole number, and we would like to obtain results as whole numbers of
days and hours, so use the int data type to declare the variables to hold the numbers of hours input, as well as the results
(the number of days and number of hours left over). The days and hours left over will need to be calculated by assignment
statements with expressions on the right side to perform the appropriate division and remainder operations. Remember
that a remainder can be calculated by using the modulus operator (%), as demonstrated in the Variables.java example
program.
Testing and Report: Run the program and check that it is producing the correct results.
Test your program for 12 hours, 100 hours, 240 hours, 250 hours, and 10000 hours. When your program is
working correctly, select the text in the console window to copy and paste it into your report file (output.txt),
adding a new section below your results for Program 2. Copy the exact output from the console after running your
program four times with the five different input values. 

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Math class and its different methods
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning