Question: a. Create a new program called Time.java. b. Create variables named hour, minute, and second. Assign values to these variables that represent the time 30

 a. Create a new program called Time.java. b. Create variables namedhour, minute, and second. Assign values to these variables that represent thetime 30 seconds after 5:15pm. Use a 24-hour clock. For example, for

a. Create a new program called Time.java. b. Create variables named hour, minute, and second. Assign values to these variables that represent the time 30 seconds after 5:15pm. Use a 24-hour clock. For example, for 2pm, the value of hour is 14 . Make the program calculate and display the number of seconds since midnight. c. Calculate and display the number of seconds remaining in the day. d. Bonus: Calculate and display the percentage of the day that has passed. You might run into problems when computing percentages with integers, so consider using floating-point. The speed of sound is approximately 340 meter per second. Because the speed of light is much faster than the speed of sound, during a thunderstorm first you see a lightning flash then you hear the sound of thunder a few seconds later. a) Start a program named SpeedLight.java (class name, main method) b) calculate the distance to a lightning strike based on the time elapsed between the flash and the sound of thunder. (you have to rearrange the formula "speed = distance / time" to obtain the distance as a function of the speed of sound (above) and a variable "time") c) test your program for the variable time =5 seconds. Note: you don't need a Scanner; just hard-code the value of time =5. Write a program to calculate the cost of car insurance based on the driver age and number of accidents. a) prompt the user to enter his/her age; at the end, print the cost of insurance for the user. b) the base insurance cost is $300 c) if the driver age is below 27 , there is a surcharge of $100 d) the additional surcharge for accidents is shown below

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!