The power of the microwave can be calculated as follows: Power=Work/Time Work is measured in joules (J) and time is measured in seconds (s), so power is expressed in joules per second (J/s) and also known as the watt (W). For example, assume that a microwave oven does 24,000 joules of work in 30 seconds. Then the power of the microwave is 800 J/s, or 800 W. Write a program that asks the user how much work does microwave do in joules and how much time it takes in seconds. It should then use a loop to display the total power at the determined time period. Use a user input validation to enforce the user to enter a value for work and time that are greater than 0. Here is an example of the output: How much work does microwave do in joules? 0[Enter] How much time it takes in seconds? 0[Enter] Invalid Work value, Enter a value greater than zero: 24000[Enter] Invalid Time value, Enter a value greater than zero: 80[Enter] Time(second) Power (watt) 20 1200 40 600 60 400 80 300

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 15PE
icon
Related questions
Topic Video
Question
100%

C++

The power of the microwave can be calculated as follows:
Power=Work/Time
Work is measured in joules (J) and time is measured in seconds (s), so power is expressed in joules
per second (J/s) and also known as the watt (W). For example, assume that a microwave oven does
24,000 joules of work in 30 seconds. Then the power of the microwave is 800 J/s, or 800 W.
Write a program that asks the user how much work does microwave do in joules and how much
time it takes in seconds. It should then use a loop to display the total power at the determined time
period. Use a user input validation to enforce the user to enter a value for work and time that are
greater than 0.
Here is an example of the output:
How much work does microwave do in joules? 0[Enter]
How much time it takes in seconds? 0[Enter]
Invalid Work value, Enter a value greater than zero: 24000[Enter]
Invalid Time value, Enter a value greater than zero: 80[Enter]
Time(second)
Power (watt)
20
1200
40
600
60
400
80
300
Transcribed Image Text:The power of the microwave can be calculated as follows: Power=Work/Time Work is measured in joules (J) and time is measured in seconds (s), so power is expressed in joules per second (J/s) and also known as the watt (W). For example, assume that a microwave oven does 24,000 joules of work in 30 seconds. Then the power of the microwave is 800 J/s, or 800 W. Write a program that asks the user how much work does microwave do in joules and how much time it takes in seconds. It should then use a loop to display the total power at the determined time period. Use a user input validation to enforce the user to enter a value for work and time that are greater than 0. Here is an example of the output: How much work does microwave do in joules? 0[Enter] How much time it takes in seconds? 0[Enter] Invalid Work value, Enter a value greater than zero: 24000[Enter] Invalid Time value, Enter a value greater than zero: 80[Enter] Time(second) Power (watt) 20 1200 40 600 60 400 80 300
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning