Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Minutes Conversion Write a program that accepts as input a number of minutes and converts it to both hours and days. Note: The number of
Minutes Conversion Write a program that accepts as input a number of minutes and converts it to both hours and days. Note: The number of minutes must be entered as an integer Create constants to store the number of minutes in an hour and the number of hours in a day. The number of hours and days must be calculated as integers. Use the remainder operator (%) to calculate any remaining minutes and hours. A sample of the output is shown below: Enter number of minutes : 6000 6000 minutes is 100 hours and 0 minutes or 4 days and 4 hours. Tip: Read up on the final keyword in section 2.9 of the zyBook to see how it is used to create constants. An example of the syntax is included below: final double SPEED_OF_SOUND = 761.207; // Miles/hour (sea level) final double SECONDS_PER_HOUR = 3600.0; // Secs/hour Energy of Light In physics, Planck's constant h is used to relate a photon's energy to its frequency. Planck's constant, h, is defined as 6.626 x 10-34. Planck's constant can be used to calculate a photon's energy by using the formula E = hf where f is the frequency of the photon. A photon's frequency, in turn can be calculated from its wavelength using the formula where 1 is the wavelength of the photon and c is the speed of light, defined as 3 x 108. With this information, write a program that accepts the wavelength of a photon. The program should calculate its frequency and energy using the formulae provided above. Note: Use constants to store Planck's constant and the speed of light. Use e-notation to write values for the constants and for any values that are expressed in powers of ten (see sample output and section 2.8 of the zyBook for examples in syntax) Samples of the output is shown below: Output 1: Enter the wavelength of the photon (in m): 700.0e-9 The frequency of the photon is 4.2857142857142856E14 Hertz. The energy of the photon is 2.83971428571428576-19 Joules. Output 2: Enter the wavelength of the photon (in m): 525.00-9 The frequency of the photon is 5.714285714285715E14 Hertz. The energy of the photon is 3.7862857142857147E-19 Joules. Note that scientific notation can be used with upper or lower case
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started