Chacha
Chacha
Chacha
ICT 12-1
1. Write a program that asks the user to input two numbers. If the first number entered is greater than the second
number, the program should print the message. “The first number is greater”; else it should print the message
“The first number is smaller.” Test your program by entering the numbers 5 and 8 and then using the numbers
11 and 2. What do you think your program will display if the two numbers are equal? Test this case.
2. In a pass/fail course, a student passes if the grade is greater than or equal to 70 and fails if the grade is lower
than 70. Write a program that accepts a grade and prints the message “A Passing grade” or “A failing grade” as
appropriate. How many runs should you make for the program written to verify that it is operating correctly?
What data should you input in each program run?
3. If money is left in a particular bank for more than 5 years, the bank pays interest rate of 4.5%; otherwise, the
interest rate is 3.0%. Write a program that uses input to accept the number of years in the variable numyears
and display the correct interest rate, depending on the value input into numyears. How many runs should you
make for the program written to verify that it is operating correctly? What data should you input in each
program run?
4. Write a program to display the message “PROCEED WITH TAKEOFF” or “ABORT TAKEOFF” depending on the
input. If the character g is entered in the variable code, the first message should be displayed; otherwise, the
second message should be displayed. How many runs should you make for the program written to verify that it
is operating correctly? What data should you input in each program run?
6. Write, compile, and run a program to compute and display a person’s weekly salary as determined by the
following conditions: If the hours worked are less than or equal to 40, the person receives $12.00 per hour;
otherwise, the person receives $480.00 plus $18.00 for each hour worked over 40 hours. The program should
request the hours worked as input and display the salary as output.
7. A senior salesperson is paid $800 a week, and the junior salesperson, $500 a week. Write a program that accepts
as input a salesperson’s status in the character variable status. If status equals s, the senior salesperson’s salary
should be displayed; otherwise, the junior’s salesperson’s salary should be displayed.
10. Write, compile and run a program that asks the user to input two numbers, check the numbers. If the first
number entered is greater than the second number, the program should print the message, “The first number is
greater.”; otherwise, it should print the message “The first number is not greater than the second.” Test your
program by entering the numbers 5 and 8 and then using the numbers 11 and 2. What will your program display
if the two numbers entered are equal?