Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//header files #include using namespace std; //a global counter variable int counter=0; //main() method int main() { double wavelength;//this variable will store wavelength //prompting user

//header files

#include

using namespace std;

//a global counter variable

int counter=0;

//main() method

int main()

{

double wavelength;//this variable will store wavelength

//prompting user for the wavelength

cout << "Please input a wavelength between 400.0 and 700.0: ";

cin >> wavelength;//reading wavelength

//counter++;//increment the counter

//checking wavelength

if (++counter,wavelength < 400.0)

{

//when wavelength is less than 400 then

cout << "Wavelength too small."<< endl;

}

else if (++counter,wavelength >= 400.0 && wavelength < 445.0)

{

//when wavelength is between 400 to 445

cout << "Your wavelength corresponds to the color Violet." ;

}

else if (++counter,wavelength >= 445.0 && wavelength < 475.0)

{

//when wavelength is between 445 to 475

cout << "Your wavelength corresponds to the color Indigo." ;

}

else if (++counter,wavelength >= 475.0 && wavelength < 510.0)

{

//when wavelength is between 475 to 510

cout << "Your wavelength corresponds to the color Blue.";

}

else if (++counter,wavelength >= 510.0 && wavelength < 570.0)

{

//when wavelength is between 510 to 570

cout << "Your wavelength corresponds to the color Green." ;

}

else if (wavelength >= 570.0 && wavelength < 590.0)

{

//when wavelength is between 570 to 590

cout << "Your wavelength corresponds to the color Yellow." ;

}

else if (++counter,wavelength >= 590.0 && wavelength < 650.0)

{

//when wavelength is between 590 to 650

cout << "Your wavelength corresponds to the color Orange." ;

}

else if (++counter,wavelength >= 650.0 && wavelength <= 700.0)

{

//when wavelength is between 650 to 700

cout << "Your wavelength corresponds to the color Red." ;

}

else if(++counter,wavelength > 700.0)

{

//when wavelength is greater than 700

cout << "Wavelength too large." ;

}

cout<

cout << endl<<"Thank-you for using our program!" << endl;

return 0;

What will a raptor flow chart of this program look like

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

2. Enrolling employees in courses and programs.

Answered: 1 week ago

Question

1. Communicating courses and programs to employees.

Answered: 1 week ago

Question

6. Testing equipment that will be used in instruction.

Answered: 1 week ago