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
Ghella [55]
2 years ago
9

People find it easier to read time in hours, minutes, and seconds rather than just seconds. Write a program that reads in second

s as input, and outputs the time in hours, minutes, and seconds
Computers and Technology
1 answer:
Arturiano [62]2 years ago
4 0

Answer:

seconds = int(input("Enter time in seconds: "))

hours = int(seconds / 3600)

minutes = int((seconds - (hours * 3600)) / 60)

seconds = seconds - ((hours * 3600) + (minutes * 60))

print("{} hour(s) {} minute(s) {} second(s)".format(hours, minutes, seconds))

Explanation:

*The code is in Python.

Ask the user to enter the time in seconds

Calculate the hours, divide the seconds by 3600 and cast it to the integer

Calculate the minutes, subtract the corresponding seconds in hours you previously found, divide it by 60 and cast the result to the integer

Calculate the seconds, subtract the corresponding seconds in hours and minutes you previously found, the remaining is the seconds you have

Print the hours, minutes, and seconds

For example, if the user enters 7310 as seconds,

hours will be int(7310/3600) = 2

minutes will be int((7310 - (2*3600)) / 60) = 1

seconds will be 7310 - ((2*3600) + (1*60)) = 50

You might be interested in
Consider the following class:
Pachacha [2.7K]

Answer:

c.return Integer.compare(value, otherTemp.value)

Explanation:

The compare() method as the name implies compares two integer values. If they are equal it returns 0, if the first number is smaller it returns -1, and if the first number is greater it returns 1.

It is an Integer class method that is why you need to type Integer.compare() to call the function.

For this example, the parameters that will be compared are <em>value</em>, and <em>otherTemp.value. </em>The type of compareTo method is an integer, we need to return the result.

3 0
3 years ago
The BIOS feature that enables a hard drive to read or write several sectors at a time is called what?
lukranit [14]

The BIOS feature that enables a hard drive to read or write several sectors at a time is called IDE block mode

Explanation:

IDE block mode setting speeds up IDE drivers when enabled by allowing multiple sectors to read or write operations. This BIOS feature rushes up hard disk drive passage by transferring many divisions of data per interrupt rather than using the normal single-sector transfer mode.

This mode of transfer is known as block transfers. When block transfers are enabled, depends on the IDE controller, nearly 64 KB of data can be transferred per interrupt.

4 0
3 years ago
Phoebe has to give a presentation about recycling. Where should she look while presenting?
Naddika [18.5K]
Well, I think that maybe the answer is B or C. She shouldn't only look at her presentation while she is presenting it, that doesn't look professional, and you want to look at the people you are talking to.
6 0
3 years ago
Read 2 more answers
What's the problem with this code ?
Svet_ta [14]
Hi,

I changed your program using some of the concepts you were trying to use. Hopefully you can see how it works:

#include <string>
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
   short T;
   cin >> T;
   cin.ignore();

   string str[100];

   for(int i=0; i<T; i++)
   {
      getline(cin, str[i]);
   }

   for (int i = 0; i < T; i++)
   {
      stringstream ss(str[i]);
      string tmp;
      vector<string> v;

      while (ss >> tmp)
      {
          // Let's capitalize it before storing in the vector
          if (!tmp.empty())
          {
              transform(begin(tmp), end(tmp), std::begin(tmp), ::tolower);
              tmp[0] = toupper(tmp[0]);
           }
           v.push_back(tmp);
        }

        if (v.size() == 1)
        {
           cout << v[0] << endl;
        }
        else if (v.size() == 2)
        {
           cout << v[0][0] << ". "  << v[1] << endl;
        }
        else
        {
            cout << v[0][0] << ". " << v[1][0] << ". " << v[2] << endl;
        }
    }

     return 0;
}

4 0
3 years ago
Kiara is using her software's graphic formats to create a line graph. As she
Ad libitum [116K]

Correct the data she entered , and the software will adjust the graph -apex

5 0
3 years ago
Read 2 more answers
Other questions:
  • Trevor got home from work and suddenly realized that he needed to edit a certain file stored in the company network's server. ho
    11·1 answer
  • Company policies require that all network infrastructure devices send system level information to a centralized server. Which of
    6·1 answer
  • You play guitar and keep two files on your computer. One file, called strings, lists the different brands of strings you keep on
    8·1 answer
  • apple and adobe are in disagreement about the use of __________ to create apps for the iphone and ipad?
    10·1 answer
  • Whats the answer to this question?
    7·1 answer
  • Write a function namedmake_complex that stores its twoarguments (both of type double) in acomplex structure, then returns thestr
    12·1 answer
  • Imagine that you are preparing a multimedia presentation. What are the four things you need to consider when getting started?
    14·2 answers
  • Circuit pruning occurs only before puberty.<br> O True<br> O False
    9·2 answers
  • I need the answers. i don’t get this
    11·1 answer
  • It's generally best to use what types of sites for factual internet research? Select all that apply from the choices below.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!