COMP 141: Project 2

The Perfect Storm

In this project, you will write a program to calculate information about tropical cyclones. These storms are known by different names: they are called hurricanes in the Atlantic Ocean and northeastern Pacific Ocean, and typhoons when they occur in the northwestern Pacific Ocean.

Hurricanes and typhoons are classified into categories based on the sustained speed of the winds inside the storm. For hurricanes, the speeds are classified on the Saffir–Simpson scale: (notice these are in miles per hour)

Hurricanes
TypeWind speed
Tropical depressionunder 39 mph
Tropical stormat least 39 mph, but less than 74 mph
Category 1at least 74 mph, but less than 96 mph
Category 2at least 96 mph, but less than 111 mph
Category 3at least 111 mph, but less than 130 mph
Category 4at least 130 mph, but less than 157 mph
Category 5157 mph or higher

For typhoons, one classification system is the following: (notice these are in kilometers per hour)

Typhoons
TypeWind speed
Tropical depressionunder 63 km/hr
Tropical stormat least 63 km/hr, but less than 88 km/hr
Severe tropical stormat least 88 km/hr, but less than 118 km/hr
Typhoonat least 118 km/hr, but less than 150 km/hr
Severe typhoonat least 150 km/hr, but less than 185 km/hr
Super typhoon185 km/hr or higher

In this program, you will have a user type in a wind speed in either miles per hour or kilometers per hour, and classify that storm on both the hurricane and typhoon scales.

What you need to do

Your program, when completed, should do the following:

Guidelines

Submission

Sample Interactions

What the computer displays (prints) is in regular text, what the user types is in bold, and what the program is doing behind the scenes is in italics.

Test 1

(Program begins)
Do you want to enter miles/hour or km/hour? (type m or k): m
What is the speed of the hurricane in miles/hour? 150
This is 241.4016746838845 km/hr.
On the hurricane scale, this is a category 4 hurricane.
On the typhoon scale, this is a super typhoon.
(Program ends)

Test 2

(Program begins)
Do you want to enter miles/hour or km/hour? (type m or k): k
What is the speed of the hurricane in km/hour? 150
This is 93.20565 mph.
On the hurricane scale, this is a category 1 hurricane.
On the typhoon scale, this is a severe typhoon.
(Program ends)

Test 3

(Program begins)
Do you want to enter miles/hour or km/hour? (type m or k): M
What is the speed of the hurricane in miles/hour? 55
This is 88.51394738409098 km/hr.
On the hurricane scale, this is a tropical storm.
On the typhoon scale, this is a severe tropical storm.
(Program ends)
Your code does not need to follow this script verbatim, but all the mentioned functionality should work as shown.

Requirements

A good program will do all of the following:
  • Be named correctly.
  • Include the standard program header as a comment at the top of your program.
  • Ask the user for all input using clear and understandable prompts.
  • Display all information using clear and understandable messages.
  • Using appropriate variable naming conventions.
  • Include code that is commented appropriately, is neatly and clearly formatted, and includes proper use of white space.
  • Hints

    Challenge Problems

    Grading

    Your program will be graded on correctness (whether your calculations are correct), as well as on coding style, which refers to choices you make when writing your code, such as good use of variable names, appropriate indentation, and comments (this is not an exhaustive list).

    You will receive one bonus point for every complete day your program is turned in early, up to a maximum of five points. For instance, if your program is due on September 20 at 11:59pm, if you turn in your code on Moodle any time on September 19 from 12:00am through 11:59pm, you will receive one extra point on your project. Programs submitted on September 18 from 12:00am through 11:59pm will receive two points. This pattern continues for up to five points.