Skip to content

CS 1415 - Lab #3

Objective: 

Program with enumerations

Preparation: 

Review section 11.12 from Starting Out with C++ by Gattis.

Programming: 

  1. Place your code in a file named LlllFfffLab03.cpp where Llll is the first four letters of your last name and Ffff is the first four letters of your first name.
  2. Define a Color enumeration with at least six common values.
  3. Write a function to display the name for a given Color value it receives.
  4. Write a function that allows the user to input a color name as a string and then it returns the corresponding Color value.
  5. Write a function that returns the wavelength as a floating-point value in units of meters for a given Color value it receives.
  6. Write a driver program that utilizes the functions described above. It should ask the user to input a color. It should then report the wavelength of that color. It should also allow the user to repeat if they desire.
  7. Verify your program works correctly.
  8. Submit your source code file to ude.wons@nosneros.htrag. Due at 8:00 am on 21 January.