Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions The Saffir - Simpson Hurricane Scale classifies hurricanes into five categories numbered 1 through 5 . Write an application named Hurricane that outputs a

Instructions
The Saffir-Simpson Hurricane Scale classifies hurricanes into five categories numbered 1 through 5.
Write an application named Hurricane that outputs a hurricanes category based on the users input of
the wind speed.
Category 5 hurricanes have sustained winds of at least 157 miles per hour. The minimum sustained
wind speeds for categories 4 through 1 are 130,111,96, and 74 miles per hour, respectively.
Any storm with winds of less than 74 miles per hour is not a hurricane.
If a storm falls into one of the hurricane categories, output This is a category # hurricane,
with # replaced by the category number. If a storm is not a hurricane, output This is not a
hurricane.
Solution
using System;
using static System.Console;
class Hurricane
{
static void Main()
{
int wind;
int category =0;
const int CAT5=157;
const int CAT4=130;
const int CAT3=111;
const int CAT2=96;
const int CAT1=74;
Write("Enter wind speed for hurricane >>");
wind = Convert.ToInt32(ReadLine());
if(wind >= CAT5)
category =5;
else
if(wind >= CAT4)
category =4;
else
if(wind >= CAT3)
category =3;
else
if(wind >= CAT2)
category =2;
else
if(wind >= CAT1)
category =1;
if(category ==0)
WriteLine("This is not a hurricane");
else
WriteLine("This is a category {0} hurricane", category);
}
}
------------------------------------------------------------------
using System;
using static System.Console;
using System.Globalization;
class HurricaneModularized
{
static void Main()
{
// Write your code here
}
}
------------------------------------------------------------------
Previously , you wrote a program named Hurricane that classified hurricanes into five categories using the Saffir-Simpson Hurricane Scale. Now, create a modified version named HurricaneModularized that passes a users input wind speed to a method that returns the hurricane category.

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

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions