Question: CPS 1 2 3 1 Lab 3 - 3 ( 2 0 points ) 1 . ( 1 0 points / 2 points each )
CPS Lab points
points points each Solve the problems below using eye. Then use Eclipse to verify your
answer.
a Assuming that x is show the result of the following Boolean expressions.
true &&
x && x
x x
x x
x x
b Write a Boolean expression that evaluates to true if age is greater than and less than
c Write a Boolean expression for x Hint: x is equivalent to x and
x
d Rewrite the following if statements using the conditional operator.
if ages
ticketPrice ;
else
ticketPrice ;
e Explain what the following conditional expression does.
intMathrandom : ;
points Recall from lab we wrote a class, NumberToMonth, which did the following. Now,
this time, write a class called NumberToMonthUsingSwitch, that does the same but uses the switch
statement.
Ask the user to enter the month of the year number through : Enter the month of the
year number to
Get the month using a Scanner.
Checks for invalid input ie numbers that are not from to and terminates the program
using System.exit if input is invalid.
Prints the name of the month: The month is XXXXX
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
