Question

In: Computer Science

Write a C++ code that can convert time into hours, minutes, seconds. It can accept (seconds),...

Write a C++ code that can convert time into hours, minutes, seconds.

It can accept (seconds), (minutes, seconds), (hours, minutes, seconds)

The input can be written in main

It should produce the following output:

(67.4, 14, 5) is 67 Hours, 38 Minutes, 5 Seconds

(127.86) is 0 Hours, 2 Minutes, 8 Seconds

(-3, 73, 2) is -1 Hours, -46 Minutes, -58 Seconds

Solutions

Expert Solution

CODE:

OUTPUT:

if we give any negative value it would not work correctly kindly apologize me

**********For any queries comment me in the comment box*************


Related Solutions

Write a program that request a time interval in seconds and display it in hours, minutes,...
Write a program that request a time interval in seconds and display it in hours, minutes, second format. (java)
PART A Write a program that converts a total number of seconds to hours, minutes, and...
PART A Write a program that converts a total number of seconds to hours, minutes, and seconds. It should do the following: Prompt the user for input Read an integer from the keyboard Calculate the result Use printf to display the output Your output must be of the format: totalSeconds seconds = numHours hours, numMinutes minutes, and numSeconds seconds For example: If the user entered: 5000 Your program would output: 5000 seconds = 1 hours, 23 minutes, and 20 seconds...
Design a clock display to show the time in hours, minutes, and seconds. Assume that we...
Design a clock display to show the time in hours, minutes, and seconds. Assume that we have a clock of exactly 1 KHz (1000 clock pulses per second). It will use 6 seven-segment displays and operate either in military time (hours 00 to 23) or regular time (1 to 12, with AM and PM). An input line, x, differentiates between the two. A seventh display is used to show A or P in the latter case; it is blank otherwise....
Need to modify the below code to return the time in minutes instead of seconds. (Using...
Need to modify the below code to return the time in minutes instead of seconds. (Using Python 2.7.6 ) def numberPossiblePasswords(numDigits, numPossiblePerDigit):     numPasswords = numPossiblePerDigit**numDigits     return numPasswords def maxSecondsToCrack(numPossiblePasswords, secPerAttempt):     time = numPossiblePasswords*secPerAttempt     return time nd = int(input("How many digits long is the passcode? "))       nc = int(input("How many possible characters are there per digit? ")) secondsPerAttempt = .08 npp = numberPossiblePasswords(nd, nc) totalSeconds = maxSecondsToCrack(npp, secondsPerAttempt) print("It will take you " + str(totalSeconds) + "...
Using Quartus to design a stopwatch that can display tenths of seconds, minutes, and hours, with...
Using Quartus to design a stopwatch that can display tenths of seconds, minutes, and hours, with the gaps between HEX displays splitting the time units (i.e. minutes on HEX[5..4], hours on HEX[7..6]). Have the stopwatch cycle through 3 states of a state machine with a pushbutton. The 3 states are counter-clear, counter-start, and counter-stop
using C program Assignment Write a computer program that converts a time provided in hours, minutes,...
using C program Assignment Write a computer program that converts a time provided in hours, minutes, and seconds to seconds Functional requirements Input MUST be specified in hours, minutes, and seconds MUST produce the same output as listed below in the sample run MUST correctly compute times Nonfunctional requirements MUST adhere to program template include below MUST compile without warnings and errors MUST follow the code template provided in this assignment MUST NOT change " int main() " function MUST...
Write C code to create a structure called time_of_day, which stores the current time in hours,...
Write C code to create a structure called time_of_day, which stores the current time in hours, minutes, and seconds. All the fields should be integers except for seconds, which should be a floating point value. Write a C function called check_time, which takes a pointer to a time_of_day structure as input, and return 1 if the time is valid (0 to 23 hours, 0 to 59 minutes, 0 to 59.999999 seconds) and 0 otherwise. Assume that times are stored in...
Write the definition for a generic / Template class called time that has hours and minutes...
Write the definition for a generic / Template class called time that has hours and minutes as structure. The class has the following member functions: SetTime to set the specified value in object ShowTime to display time object Sum to sum two time object & return time Write the definitions for each of the above member functions. Write main function to create three time objects. Set the value in two objects and call sum() to calculate sum and assign it...
Time Remaining 2 hours 2 minutes 11 seconds 02:02:11 Item 6 Item 6 Time Remaining 2...
Time Remaining 2 hours 2 minutes 11 seconds 02:02:11 Item 6 Item 6 Time Remaining 2 hours 2 minutes 11 seconds 02:02:11 The Molson Company had budgeted production for the year as follows: Quarter 1 2 3 4 Production in units 11,700 13,700 19,600 15,700 Four pounds of raw materials are required for each unit produced. Raw materials on hand at the start of the year total 5,700 lbs. The raw materials inventory at the end of each quarter should...
1. Write a C++ code segment to read 50 temperature values in Fahrenheit and to convert...
1. Write a C++ code segment to read 50 temperature values in Fahrenheit and to convert them to Celsius. You convert a Fahrenheit temperature to Celsius by using the following formula: Celsius = 5.0 / 9 * (Fahrenheit - 32). 2.A client has purchased 20 products in a store. Write a C++ code segment to read the unit price and the number of items of each product and to compute and print the total price of all these products.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT