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, 22.06.2019 13:00
Which part of the cpu accepts data?
Answers: 1
question
Computers and Technology, 22.06.2019 18:00
Suppose an astronomer discovers a large, spherical-shaped body orbiting the sun. the body is composed mostly of rock, and there are no other bodies sharing its orbit. what is the best way to categorize this body? a. planet b. moon c. comet d. asteroid
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a.an advanced knowledge of physics and math b.an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
1. ask the user how many questions are in the quiz. 2. ask the user to enter the key (that is, the correct answers). there should be one answer for each question in the quiz, and each answer should be an integer. e.g., 34 7 13 100 81 3 9 10 321 12 might be the key for a 10-question quiz. you will need to store the key in an array. 3. ask the user to enter the answers for the quiz to be graded. there needs to be one answer for each question. note that these answers do not need to be stored; each answer can simply be compared to the key as it is entered. 4. when the user has entered all of the answers to be graded, print the number correct and the percent correct. 5. add a loop so that the user can grade any number of quizzes with a single key. after the results have been printed for each quiz, ask "grade another quiz? (y/n)." note: you only have one array (the key). you are not creating a new key for each set of quiz answers.
Answers: 3
You know the right answer?
Write a program that converts a total number of seconds to hours, minutes, and seconds.
It sho...
Questions
question
Mathematics, 25.07.2019 16:30
Questions on the website: 13722363