Lesson Plan
 
IMOS Home Student Center TallTech Home
 

March 2, 2000

Details

Title

Input & Decision Making

Time Allotment

3 hrs

Reading / References

Objectives

Exercises (For Hand In)

Assignment #: JA01
Assignment: Input/Selection
Due: Mar 7/2000
Marks: 10 marks (5 marks each)

Demo

Samples:

FOR DEMO

1.  UPDATED WEIGHT CONVERTER

Create a weight converter as from last class. This converter should be able to handle conversions either direction. A variable should be passed as the parameter that will allow the decision of which way to convert. Use a string variable as the parameter: Direction = "K" indicates conversion from Kilos to Lbs, Direction = "L" indicates conversion from Lbs to Kilos.

2.  RECORD RAINFALL

The average high and average low rainfall for July are 24mm and 11mm respectively. Write a program that allows the user to enter the rainfall for July. The program then determines if the rainfall was within the average rainfall range.

Define three variables:

                Var RainFall

                Var MaxRain = 24

                Var MinRain = 11

Assign a value to RainFall to a number of your choice.

Test the value of rainfall against the minimum and maximum rainfall. There is actually two tests to make: is RainFall greater than or equal to min? And is Rainfall less than or equal to Max? Here is how we would form this complex logical expression:

                RainFall>=MinRain && RainFall<=MaxRain

Write the conditional statements that will display either "The amount of rainfall is within normal" or "The amount of rainfall is not within normal" based on the numbers.

3.  MONTH DISPLAY

The "Month" should be the actual name of the month.

Use nested if statements similar to:

      If (NumMonth == 1)
      {
            StringMonth = "January";
      }
      else
      {
            if (NumMonth == 2)
            {
                  StringMonth = "February";
            }
            else
            {
 
                  // continue with rest of months.