Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is my code. It will print out hours, minutes, and seconds, but I am confused about how to proceed. 1.3: Convert seconds into hours

image text in transcribed
Here is my code. It will print out hours, minutes, and seconds, but I am confused about how to proceed. image text in transcribed
1.3: Convert seconds into hours (fractional) Next, you will add logic to your ConvertToHours program so that it will also convert the given number of seconds to a fractional number of hours. 1. Open your file named ConvertToHours.java. 2. Add code to your existing program so it does the following: a) Calculates the entered number of seconds to a fractional number of hours. b) Prints the fractional result to the console. Here is a test case with 5,322 seconds Output: Total seconds: 5322 Hours: 1 Minutes: 28 Seconds: 42 Fractional hours: 1.47833333 333 1 2 public class ConvertToHours { 30 public static void main (String[] args) 4 { 5 //type a number of seconds to convert into hours 6 var seconds = 600; 7 var minutes = seconds /60; 8 var hours = minutes / 60; 9 var remaniningSeconds = seconds % 60; 10 11 System.out.println(seconds + " Seconds is " + " " 12 + hours + " Hours and " + " " 13 + minutes + Minutes and + " " 14 + remaniningSeconds + " seconds " ); 15 16 17 } 18 } 11

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Students also viewed these Databases questions