DECISION PROGRAMS

 

All of the following programs need to use VARIABLES (wherever you CAN use a variable, use one!), GET FOCUS on all text objects, and ERROR HANDLERs!!  FORMAT function with string variable as output on at least 3 programs (the money programs are good ones for this.)

 

 

1.      Write a program to find the larger of two numbers input by the user.  It will display the output:  The larger number is…

 

2.      Write a program that requests the costs and revenue for a company and displays the message “Break even” if the costs and revenue are equal or otherwise displays the profit or loss (labeled as such) as output.

 

3.      Write a program to determine how much to tip the waiter in a fine restaurant.  The program will request the cost of the meal.  The tip should be calculated as 15 percent of the check, if the meal is $20 or more, and 10 percent of the check if it is less than $20.

 

4.      A computer store sells diskettes at 50 cents each for small orders or at 30 cents each for orders of 25 diskettes or more.  Write a program that requests the number of diskettes ordered and displays the total cost.  (Test the program for purchases of 5, 25 and 35 diskettes.)

 

5.      Write a program to handle a savings account withdrawal.  The program should request the current balance and the amount of the withdrawal as input and then display the new balance.  If the withdrawal is greater than the original balance, the program should display “Withdrawal denied.”  If the new balance is less than $100, the message “Balance below $100” should be displayed.

 

 

6.      Federal law requires hourly employees be paid “time-and-a-half” for work in excess of 40 hours in a week.  For example, if a person’s hourly wage is $8 and he works 60 hours in a week, his gross pay should be

(40 x 8) + (1.5 x 8 x (60 – 40)) = $560

Write a program that requests as input the number of hours a person works in a given week and his hourly wage, and then displays his gross pay

 

7.      Write a program that requests the kind of tires (Two Check Boxes to choose from-Super or Deluxe) and how many tires purchased as input and then displays the total cost of the sale.  Super tires cost $57.50 and Deluxe tires cost $79.50.  The program should make sure the user chooses SUPER or DELUXE, they cannot choose both.

 

8.      Write a program used by an airport to calculate aircraft fees.  The program will request the name of the aircraft and the weight.  The fee of aircraft 5000 lbs or less is $5, the fee for aircraft weighing 5000 lbs or more is $10.  The program will allow the user to input several aircraft in one session. Each time one is entered the program will display the output: “The aircraft ________ costs _________.” Also, each time it will display the output printing a running COUNT and TOTAL:  “The running total cost of all aircraft for this session is ______.”  And “The running count of the number of aircraft processed is_______.”

 

9.      Write a program where the computer will generate a random number (between 1 and 100) and will request the user to guess what this number is.  The program will check to see if the guess is less than the computer’s number and display the output “Your guess is too low” and will check to see if the guess is greater than the computer’s number and display the output “Your guess is too high”.  Finally, if the user’s guess is correct it will display an appropriate message.  (This program was a suggestion of Allan Jackson)