Skip to content

Files

Latest commit

 

History

History

Problem_04

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Exercise 1:

Write a program RollLoadedDie.java that prints the result of rolling a loaded die such that the probability of getting a 1, 2, 3, 4, or 5 is 1/8 and the probability of getting a 6 is 3/8.

Exercise 2:

Write a program Hurricane.java that that takes the wind speed (in miles per hour) as an integer command-line argument and prints whether it qualifies as a hurricane, and if so, whether it is a Category 1, 2, 3, 4, or 5 hurricane. Below is a table of the wind speeds according to the Saffir-Simpson scale.

Category ______ Wind Speed (mph)

1 _______________ 74 - 95

2 _______________ 96 - 110

3 _______________ 111 - 130

4 _______________ 131 - 155

5 _______________ 156 and above

Exercise 3:

Write a program Harmonic.java that takes input an integer n from command line and output the nth harmonic number Hn = 1 + 1/2 + 1/3 + ... + 1/n.