Question: Here is the assignment 6 task 3 below the one I have to update. Here is the code to make it easier import java.util.Scanner; public

 Here is the assignment 6 task 3 below the one I

Here is the assignment 6 task 3 below the one I have to update.

have to update. Here is the code to make it easier import

java.util.Scanner; public class CountDayshourseconds { public static void main(String[] args) { //Declaring

Here is the code to make it easier

import java.util.Scanner; public class CountDayshourseconds { public static void main(String[] args) { //Declaring variables int fromseconds,hours,minutes,seconds,toSeconds; //Scanner class Object to read the inputs entered by the user Scanner sc=new Scanner(System.in); while(true) { //getting the number of seconds entered by the user System.out.print("Enter Total Number of Seconds :"); fromseconds=sc.nextInt(); if(fromseconds>=86400) { System.out.println(" Invalid seconds Must be less than 1 day "); continue; } else break; } //calling the method secondTime() by passing the seconds as arguments secondTime(fromseconds); } /*This method will converts the seconds to hours,minutes,seconds * Params:total Seconds * Return:String */ private static void secondTime(int totseconds) { //Declaring variable int secs=totseconds; //calculating the number of hours int hours=totseconds/3600; totseconds=totseconds-(hours*3600);

//calculating the number of minutes int minutes=totseconds/60; totseconds=totseconds-(minutes*60);

//Calculating the number of seconds int seconds=totseconds;

//displaying the total seconds to hours,minutes,seconds System.out.println(secs+" Seconds is "+hours+" hours "+minutes+" minutes "+seconds+" seconds"); } }

30 points) Task 1: UPDATE ASSIGNMENT 6 TASK 3 To receive full credit programmers must apply coding conventions for code block indentation, comments describing methods classes white space between code blocks, and variable/method/class naming conventions We now want the program to calculate days, hours, minutes, seconds up to one 1 week (7 days You will (if) conditional statements and code blocks to create the program. (Utilize if/else or nested as necessary) Place program inside an indefinite loop that will loop continuously until the user enters a valid seconds value. Input must be seconds 0 and seconds 7 days. The program should prompt the user and allow the user to enter input again Outpute number seconds input and a conversion to Days, Hours, minutes and remaining seconds Only output days if there are enough seconds for 1 day. Only output hours if there are enough seconds for 1 hour. Only output minutes if there are enough seconds for 1 minute. Attach Snipping photo of Source Code and Output Provide multiple outputs to demonstrate all code blocks work as expected

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 Databases Questions!