Objective : To introduce Enumeration types.
Problem: To write an ADA program that determines the winner in a game of "rock,paper,scissors".
In this game ,two players choose simultaneously either rock,paper,scissor.Whether a
player wins or looses depends not only on the player's choice but also on his opponent's.
Rules :If the first player chooses Rock and the second player chooses scissors
Rock breaks scissors :rock wins
Similarly :
Paper covers rock :paper wins
Scissor cuts paper :scissor wins
If both select same then it is a tie
Task :
The program should prompt for and read the two player's choices in the following manner
Enter the choices made by the two players : <-----Prompt of the program
scissor rock <-----Input entered by the user
It should then determine the winner and print the winner.
The second player's choice of rock beat scissors <-----Output of the program
Here's another example
Enter the choices made by the two players : <-----Prompt of the program
paper rock <-----Input entered by the user
The game is a tie <-----Ouput of the program
Use :
Objective :To introduce FOR loop.
Task : You are required to modify the Wind Chill program done in Lab 5 such that it takes as
input the temperature from the user and calculates the wind chill for
wind speed = 0,5,10,15,20,25(Link to Lab5 Part 2)
Conditions: The wind chill is equal to the temperature if the wind speed is less than 4.
If wind speed is greater than or equal to 4 and less than or equal to 45 then the
wind chill is
wind_chill= (91.4-x*y) where x and y are
x=10.45 + 6.65 * (Sqrt(wind_speed)) - 0.447*(wind_speed)
y=(91.4 - temperature)/22.0
If the wind speed is greater than 45 then the wind chill is equal to (1.6*float(temperature)-55)
Output : Example:
Enter the temperature : <------Prompt by the program
5 <------Temperature entered by the user
Wind speed Wind Chill <------Output of the program
0 5
5 0
10 -15
15 -25
20 -32
25 -37
Helpful Stuff :
Task : To modify the Ada program written in Part 2 such that it calculates the Wind Chill for
temperature=-5,0,5,10,15,20 and wind speed=0,5,10,15,20,25.
Output : The program calculates the wind chill for all the values of wind speed and temperature and
prints it in the following format
Wind Speed/temperature -5 0 5 10 15 20 <-------Output of the program
0
5
10
15
20
25
Hint:
Use Nested FOR Loop
Ryan Stansifer <ryan@cs.fit.edu>
G.S.A:Rishi Gupta <rgupta@cs.fit.edu>
Last modified: Tue Jan 26 15:19:11 EST 1999