Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem Statement Wavelengths of visible light are approximately in the range of

ID: 3640142 • Letter: P

Question

Problem Statement
Wavelengths of visible light are approximately in the range of .4 to .7 microns. The table below shows the relationship between color and wavelength. Write a program that asks the user to supply a wavelength. The program should use that input and the tabular values to display the color (as text) associated with the input wavelength. Any input wavelength less than .4 microns or greater than .7 microns should return an error message stating that the input wavelength is outside the range of visible light.

Remember. Literal floating point numbers are often stored in memory as doubles. When comparing floating point numbers, it might be preferable to compare numbers of the same data type, float to float, double to double, etc.

Wavelength range(microns) color
.400 to less than .424 violet
.424 to less than .491 blue
.491 to less than .575 green
.575 to less than .585 yellow
.585 to less than .647 orange
.647 to less than .700 red


Not really sure how to go about this one. How do you know what formulas to use and when to use If/ AND statments. All my teacher does is go thru slideshows. Im reading 2 txt books to teach myself C++.

Explanation / Answer

double wl; cin>>wl; if(wl0.7) cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote