Your program is to calculate a consultant’s invoice to their client. The consultant charges $85 per
hour, however there is a minimum of 5 hours to be billed regardless of the hours worked. Read the
amount of hours worked from the keyboard and calculate what the invoice total will be. You are to
use the ternary if statement to perform this calculation.
Page name: consultant.html
Decision structure: ternary or conditional operator
4. Test a logical OR condition
Your program is to read in 2 results indicating whether the result is a pass or a fail. The user need
only pass one of the tests in order to be considered competent. You are to use the logical “OR”
operator to determine their competence. Display a message indicating whether they are competent
or not yet competent.
8. Test the switch statement using a single case
Your program is to prompt the user to enter X, Y or Z. Use a switch statement to display the
appropriate message: You entered X, You entered Y, or you entered Z.
Page name: Switch SingleCase.html
Decision structure: switch statement
Page name: LogicalOr.html
Decision structure: if-else using 11
9. Test the switch statement using mixed case
Your program is to read a price code from the user and display the appropriate price per kilogram
according to the following table:-
Price Code
A
B
с
Price / kg
$1.50
$2.85
$5.60
5. Test a logical AND condition
Your program is to read in 2 results indicating whether the result is a pass or a fail. The user must
pass both of the tests in order to be considered competent. You are to use the logical and operator
to determine their competence. Display a message indicating whether they are competent or not yet
competent.
Page name: LogicalAnd.html
Decision structure: if-else using &&
6. Test a logical NOT condition
Your program is to read in the age from the keyboard. If the age is not less than 18 you are to
display a message informing the user that they are eligible to enroll to vote.
Page name: LogicalNot.html
Decision structure: if-else using “!” operator
You program should also accept the price code in lower case. The output should be formatted to be
displayed as currency.
Class name: Switch MultiCase.html
Decision structure: switch statement
End of documenti
7. Test the ternary if statement