This question is a good practice question for your final exam. Complete it successfully before the due date for +1% to be added to your final mark. Clara has taken up a job as a time keeper. You need to write a program that takes as input an amount in seconds (a positive integer number), and then print to console the number of days, hours, minutes and seconds in that amount. Hint: There are 60 seconds in a minute, 60 minutes in an hour, and 24 hours in a day. Your solution should validate the user's input to ensure it is a positive integer value. Example 1. If the user enters 61 seconds, your program should output: Number of Days: 0 Number of Hours: 0 Number of Minutes: 1 Number of Seconds: 1 Example 2. If the user enters 86401 seconds, your program should output: Number of Days: 1 Number of Hours: 0 Number of Minutes: 0 Number of Seconds: 1

University/Course: WSU

Uploaded: October 27, 2024

Files: 1

✓ Solution:

class MyClara extends Clara { 
/**
     * In the ‘run()’ method, we will write the program for Clara 
     */
void run() {
int totalSeconds = 0;
// Prompt the user to input time in seconds
        totalSeconds = readInt(“Enter time in seconds: “);  // Receive the input as an integer
if (totalSeconds < 0) {
            System.out.print(“Please provide a positive number.”);
        } else {
// Constants for time conversions
int SECONDS_IN_MINUTE = 60;
int MINUTES_IN_HOUR = 60;
int HOURS_IN_DAY = 24;
// Breaking down the total seconds into days, hours, minutes, and seconds
int remainingSeconds = totalSeconds % SECONDS_IN_MINUTE;

🔒 Whatsapp us for the full file.