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

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
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...
Time Remaining 3 hours 5 minutes 26 seconds 03:05:26 eBook Check my work Check My Work...
Time Remaining 3 hours 5 minutes 26 seconds 03:05:26 eBook Check my work Check My Work button is now disabled Item 3 Item 3 Time Remaining 3 hours 5 minutes 26 seconds 03:05:26 Polaski Company manufactures and sells a single product called a Ret. Operating at capacity, the company can produce and sell 38,000 Rets per year. Costs associated with this level of production and sales are given below: Unit Total Direct materials $ 20 $ 760,000 Direct labor 10...
Time Remaining 5 minutes 19 seconds 00:05:19 Item 23 Item 23 Time Remaining 5 minutes 19...
Time Remaining 5 minutes 19 seconds 00:05:19 Item 23 Item 23 Time Remaining 5 minutes 19 seconds 00:05:19 On April 1st, Bob the Builder entered into a contract of one-month duration to build a barn for Nolan. Bob is guaranteed to receive a base fee of $5,800 for his services in addition to a bonus depending on when the project is completed. Nolan created incentives for Bob to finish the barn as soon as he can without jeopardizing the structural...
Time Remaining 46 minutes 30 seconds 00:46:30 Item 7 Item 7 Time Remaining 46 minutes 30...
Time Remaining 46 minutes 30 seconds 00:46:30 Item 7 Item 7 Time Remaining 46 minutes 30 seconds 00:46:30 On Dec 31, 20X2, the end of the year, Schubert Co. had the following stockholders’ equity. You have been given the ending balances for the year and asked to compute the balances as of the beginning of the year. 9% Preferred Stock, $40 par $   600,000 Common Stock, $8 par $   960,000 Add’l PIC $1,355,000 Retained Earnings $1,255,000 Treasury Stock, 4,000 shares...
convert following C++ code into MIPS assembly: int main() {                                 &
convert following C++ code into MIPS assembly: int main() {                                         int x[10], occur, count = 0;                                                              cout << "Type in array numbers:" << endl; for (int i=0; i<10; i++) // reading in integers                               { cin >> x[i];        } cout << "Type in occurrence value:" << endl;                                 cin >> occur;                                                 // Finding and printing out occurrence indexes in the array                                  cout << "Occurrences indices are:" <<...
Time String to Seconds Write a method that takes a string representation of time in hours:minutes:seconds...
Time String to Seconds Write a method that takes a string representation of time in hours:minutes:seconds and returns the total number of seconds For example, if the input is “0:02:20” it would return 140 If the input string is missing the hours component it should still work For example, input of “10:45” would return 645 Write an overloaded form of the method that takes in only hours and minutes and returns the total number of seconds It should leverage the...
Write a program that accepts a number of minutes and converts it both to hours and...
Write a program that accepts a number of minutes and converts it both to hours and days. For example, 6000 minutes is 100.0 hours or 4.166666666666667 days. (I currently have what is below) import java.util.Scanner; public class MinutesConversion { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int numOfMinutes = sc.nextInt(); double hour = numOfMinutes/60.00; double days = (hour/24); System.out.println(numOfMinutes + " minutes is " + hour + " hours or " + days + " days.");...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT