subject
Computers and Technology, 11.02.2020 22:20 dee3874

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
5000 seconds = 01h:23m:20s

Sample run would look like:
Enter the number of seconds: 5000
5000 seconds = 1 hours, 23 minutes, and 20 seconds
5000 seconds = 01h:23m:20s

Sample run would look like:
Enter the number of seconds: 3754
3754 seconds = 1 hours, 2 minutes, and 34 seconds
3754 seconds = 01h:02m:34s

Hint1:Use integer division

Hint2: Use the modulus operator

Please make sure to end each line of output with a newline.
Please note that your class should be named SecondsConverter.

PART B

Write a program that converts change into formatted dollars and cents It should do the following:

Prompt the user for their change in Quarters, Dimes, Nickels, Pennies
Read the integers from the keyboard
Calculate the result
Use printf to display the output as $d. cc
Your output must be of the format: (plural is ok even when grammatically incorrect)

You entered:
6 quarters
5 dimes
4 nickels
3 pennies
The total in dollars is $2.23

Sample run would look like:

Enter the number of quarters: 6
Enter the number of dimes: 5
Enter the number of nickels: 4
Enter the number of pennies: 3
You entered:
6 quarters
5 dimes
4 nickels
3 pennies
The total in dollars is $2.23

Sample run would look like:

Enter the number of quarters: 1
Enter the number of dimes: 2
Enter the number of nickels: 3
Enter the number of pennies: 2
You entered:
1 quarters
2 dimes
3 nickels
2 pennies
The total in dollars is $0.62
Hint1: Use printf and be sure to have at least 1 digit to the left of the decimal, and a max of 2 floating on the right.

Please make sure to end each line of output with a newline.
Please note that your class should be named ChangeConverter.

PART C

Write a program that converts a temperature from Celsius to Fahrenheit.
It should do the following:

Prompt the user for input
Read a double value from the keyboard
Calculate the result. Here is the formula. F = ( C * 9 / 5 ) + 32
Format the output to one decimal place.
Your prompt to the user to enter the temperature in Celsius must be: Enter the Celsius Temperature as a decimal:

Your output must be of the format: celsiusTemperature C = fahrenheitTemperature F

For example: If the user entered: 24.0
Your program would output: 24.0 C = 75.2 F

Sample run would look like:
Enter the temperature in degrees celsius: 24
24.0 C = 75.2 F

Sample run would look like:
Enter the temperature in degrees celsius: 7.5
7.5 C = 45.5 F

Hint1: Be careful not to use integer division!
Here is the formula F = ( C * 9 / 5 ) + 32

Hint2: Remember to use printf to format the output.
Please make sure to end each line of output with a newline.
Please note that your class should be named CelsiusToFahrenheit.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
Matlab question: use switch and anythe lottery game matches three different integer numbers between 1 and 10. winning depends on how many matching numbers are provided by a player. the player provides three different integers between 1 and 10.if there is a match of all 3 numbers, the winning $ 1000.if there is a match with 2 numbers, the winning $ 10.if there is a match of all with 1 numbers, the winning $ 1.with no match, the winning is $0.write a function lottery3 that checks three numbers provided by a player and determine the winning amount. if the user mistakenly enters same number twice/thrice and if that number matches one of the winning numbers, the code should count that number only once and display correct result. the player doesn’t have to guess the order of numbers.the input to the function lottery3 can have up to two input arguments. the first input argument is a row array numbers with 3 numbers. if the second argument input testcode is present, and is a row vector of 3 values, the function lottery3 uses the code in testcode as the three winning numbers (the test must be three different integer numbers between 1 and 10), else three different numbers will be automatically generated by testcode.the ouput should return the variable winnings and the three winning numbers in the row array winnumbers.hint: make use of the internal function any.restriction: the function must use switch-case statements to determine the winning.example #1: winning = lottery3( [1,2,1],[1,2,3])produceswinning =10example #2: [winning,winnumbers] = lottery3( [1,2,3])produceswinning =3winnumbers =8 5 3
Answers: 1
question
Computers and Technology, 23.06.2019 21:40
language consists of basic components, and they are called a. 3; mental images, concepts, and speech b. 2; language acquisition and linguistic relativity c. 3; heuristics, algorithms, and analogies d. 4; phonemes, morphemes, syntax, and semantics e. 2; words and grammar
Answers: 3
question
Computers and Technology, 24.06.2019 16:00
Which of the following characters is acceptable to use in a filename? ? / – %
Answers: 1
question
Computers and Technology, 25.06.2019 12:00
Understanding the or how each piece of the production process leads to customer satisfaction at the end is another important skill related to workflow.
Answers: 1
You know the right answer?
Write a program that converts a total number of seconds to hours, minutes, and seconds.
It sho...
Questions
question
French, 19.03.2021 05:20
question
Mathematics, 19.03.2021 05:20
question
Mathematics, 19.03.2021 05:30
question
Mathematics, 19.03.2021 05:30
Questions on the website: 13722361