Lab 4

Write C++ programs that produce solutions for the following problems.

  1. Suppose category is a variable of type int. Write a multi-branch if/else statement to display wind speed of each hurricane category. For a category 1 hurricane display that the wind speed is 74-95 mph, for category 2 the wind speed is 96-110 mph, for category 3 the wind speed is 111-130 mph, for category 4 the wind speed is 131-155 mph, for category 5 the wind speed exceeds 155 mph.
  2. Sample run of program:
    Enter a category of hurricane (1 through 5): > 3 The wind speed is 111-130 mph.

  3. A shoe store is giving a 10% reduction on any shoes with an original price of $125 or more. Calculate the reduced price for a pair with cost x.
  4. Sample run of program:
    What is the original price? > 130 The reduced price is $117.

    Sample run of program:
    What is the original price? > 90 That does not qualify for a discount. The price is $90.

  5. Print the discounted version of a variable price. If the original price is at most $100, the discount is 20%, otherwise the discount is 40%.
  6. Sample run of program:
    What is the original price? > 80 That qualifies for a 20% discount. Your discounted price is $64.

    Sample run of program:
    What is the original price? > 150 That qualifies for a 40% discount. Your discounted price is $90.