1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
bonufazy [111]
3 years ago
6

• Write a program that asks the user to enter a number of seconds. • If there are less than 60 seconds input, then the program s

hould display the number of seconds that was input. • There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds (note that ther

Computers and Technology
2 answers:
damaskus [11]3 years ago
8 0

Answer:

Here is the program in C++. Let me know if you want this program in some other programming language.

#include <iostream> //for input output functions

using namespace std;//to detect objects like cin cout

int main()//start of main() function body

{  int seconds; // stores the value of seconds

   int time;    // stores value to compute minutes hours and days

   cout << "Enter a number of seconds: ";

//prompts user to enter number of seconds

   cin >> seconds; // reads the value of seconds input by user

   if (seconds <= 59) //if the value of seconds is less than or equal to 59

   { cout << seconds<<" seconds\n";    } //displays seconds

   else if (seconds >= 60 && seconds < 3600)

//if value of seconds is greater than or equal to 60 and less than 3600

   {  time = seconds / 60; //computes minutes

       cout << time << " minutes in "<<seconds<<" seconds \n ";    }

//displays time in minutes

   else if (seconds >= 3600 && seconds < 86400)    {

//if input value of secs is greater than or equal to 3600 and less than 85400

       time = seconds / 3600; //calculate hours in input seconds

       cout << time << " hours in "<<seconds<<" seconds \n";   }

//displays the time in hours

   else if (seconds >= 86400)    { //if seconds is greater or equal to 86400

       time = seconds / 86400; //compute the days

       cout << time << " days in  "<<seconds<<" seconds \n";   } }

//displays the number of days in input number of seconds

Explanation:

This program first prompts the user to enter the time in seconds and computes the number of minutes, hour or days according to the conditions specified in the program. If the value of seconds entered by the user is less than or equal to 59, the number of seconds are displayed as output, otherwise the if and else if conditions are checked if the input value of seconds is greater than 60 to compute the corresponding minutes, hours or days. Everything is explained within the comments in the program.You can change the data type of time variable from int to float to get the value floating point numbers. Here i am using int to round the time values. The screenshot of the output is attached.

serious [3.7K]3 years ago
6 0

Answer:

The solution code is written in Python:

  1. sec = int(input("Enter number of seconds: "))
  2. if(sec >=60):
  3.    min = sec // 60
  4.    sec = sec % 60
  5. else:
  6.    min = 0
  7. print(str(min) + " minutes " + str(sec) + " seconds")

Explanation:

Firstly, use input function to prompt user to enter number of seconds and assign the input value to variable sec (Line 1).

Next, create an if statement to check if the sec is bigger or equal to 60 (Line 3). If so, we user // operator to get minutes and use % operator to get the seconds (Line 4 - 5).

Then we use print function to print the minutes and seconds (Line 9).

You might be interested in
Explain in detail, how the Depth Wavelet Transform (DWT) algorithm works, specifically with respect to EEGs (a non-invasive brai
andreyandreev [35.5K]

Electroencephalography-(EEG-) based control is a noninvasive technique which employs brain signals to control electrical devices/circuits.

This should help you

3 0
2 years ago
A user has reported that their workstation is running slowly. You perform a reboot of their workstation and receive a S.M.A.R.T.
abruzzese [7]

The  actions that one need todo or perform FIRST is to backup the hard drive.

<h3>What causes a SMART error?</h3>

A composition of bad blocks can be a tool that can  lead to a SMART error, or when the drive of the system's temperature is known to have gotten too high as a result of poor ventilation or other environmental factors.

Note that The  actions that one need todo or perform FIRST is to backup the hard drive. because by doing so, one can be able to retrieve information back.

Hence the answer is correct.

Learn more about S.M.A.R.T. error from

brainly.com/question/26985946

#SPJ1

5 0
2 years ago
Which two computer peripherals are connected to the computer through a port?
chubhunter [2.5K]
Most computer devices are connected to the computer through port
Keyboard through usb port
Printer through usb port
Hand point device through usb port
Also computer equipped with LPT port for printers and COM port for additional devices like external modems e.t.c
7 0
4 years ago
Thank you very much for your email. ...... was very interesting​
Fynjy0 [20]

Answer:

hi everyone how was your day :)

Explanation:

6 0
4 years ago
write a method that returns a string in the form of hour:minute:second for a given total seconds using the following header: pub
Monica [59]

A method that returns a string in the form of the hour: minute: second for a given total second that utilizes the given header is as follows:

class Convert {

public static String format(long seconds) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter total seconds: ");

int secs = sc.nextInt();

int hours = secs / 3600;

int minutes = (secs % 3600) / 60;

int seconds = (secs % 3600) % 60;

String timeFormat = hours + ":" + minutes + ":" + seconds;

return timeFormat;

}

}

<h3>What is the String function?</h3>

The string function may be characterized as the type of function in a computer's programming function that may significantly have a non-numerical result.

String functions are typically utilized in computer programming languages in order to manipulate a string or query information about a string successfully.

Therefore, a method that returns a string in the form of the hour: minute: second for a given total second that utilizes the given header is well described above.

To learn more about Header, refer to the link:

brainly.com/question/2329500

#SPJ1

5 0
1 year ago
Other questions:
  • In procedural programming, where does the flow of control usually route from the main function?
    8·1 answer
  • A Chief Information Officer (CIO) recently saw on the news that a significant security flaws exists with a specific version of a
    5·1 answer
  • Clunker Motors Inc. is recalling all vehicles from model years 1995-1998 and 2004-2006.Given a variable modelYear write a statem
    5·1 answer
  • What the address for dns server that the eorkstation will use?
    10·1 answer
  • Which of the following websites can help you learn about general career trends? A. Bureau of Labor Statistics B. Career Cruising
    6·1 answer
  • Which allows for saving a setting on one device and having the setting synchronize to other devices? Choose two answers.
    12·1 answer
  • Combinations of spaces and special characters can be used in domain names of uniform resource locators (urls).
    6·2 answers
  • Expanding the virtual width of a game makes it possible to _______________. A. Expand the size of the player's game window B. Cr
    8·1 answer
  • Related to Image Classification
    13·1 answer
  • Which popular tool is used in agile software development TCS?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!