CIS 150 Lab: Selection

Objectives

  • Fix tests that check for values and ranges
  • Create working C++ switch statements
  • Create selection statements that detect different ranges of values

Lab requirements

Modify the supplied program (decisionsLab.cpp) to make it work properly.

Example run of program

Part 1 Testing with age = 50 Age is less than 65 Admission: 15.00 Testing with age = 65 Age greater than or equal to 65 Admission: 10.00 Testing with age = 80 Age greater than or equal to 65 Admission: 10.00 Part 2 Testing with count = 5 The count is NOT 10 Testing with count = 10 The count is 10 Testing with count = 15 The count is NOT 10 Part 3 Testing with score = -50 The score is out of range Testing with score = 0 The score is in range Testing with score = 50 The score is in range Testing with score = 100 The score is in range Testing with score = 150 The score is out of range Part 4 1. Enter data and save to file 2. Read data in and display report 3. Quit the program Testing with option = -1 Invalid choice Testing with option = 0 Invalid choice Testing with option = 1 Enter data Testing with option = 2 Read data Testing with option = 3 Quit Testing with option = 4 Invalid choice Part 5 Testing with sales = $0.00 The commission is $0.00 Testing with sales = $2500.00 The commission is $50.00 Testing with sales = $5000.00 The commission is $100.00 Testing with sales = $7500.00 The commission is $150.00 Testing with sales = $10000.00 The commission is $200.00 Testing with sales = $12500.00 The commission is $375.00 Testing with sales = $15000.00 The commission is $450.00 Testing with sales = $17500.00 The commission is $700.00 Testing with sales = $20000.00 The commission is $800.00 Testing with sales = $22500.00 The commission is $1125.00 Testing with sales = $25000.00 The commission is $1250.00 Press enter to continue...

Rubric

  • 2 points: for getting part 1 working properly
  • 2 points: for getting part 2 working properly
  • 2 points: for getting part 3 working properly
  • 2 points: for getting part 4 working properly
  • 2 points: for getting part 5 working properly