Chapter 3: Problem 21
Assume the variable name references a string object. Write an if statement that displays "Do I know you?" if the string object contains "Timothy".
Chapter 3: Problem 21
Assume the variable name references a string object. Write an if statement that displays "Do I know you?" if the string object contains "Timothy".
All the tools & learning materials you need for study success - in one app.
Get started for freeWrite an if statement that multiplies payRate by 1.5 if hours is greater than 40 .
Write an if statement that sets the variable fees to 50 if the boolean variable max is true.
Write an if-else statement that assigns 0.10 to commission unless sales is greater than or equal to 50000.0 , in which case it assigns 0.2 to commission.
Write an if statement that assigns 0 to \(x\) when \(y\) is equal to 20 .
Rewrite the following if-else-if statement as a switch statement. If (selection = "A") System.out.println"You selected A." 1 If (selection = "B") System.out.println"You selected B." 1 If (selection = "C") System.out.println"You selected C." 1 If (selection = "D") System.out.println"You selected D." 1 else System.out.println"Not good with letters, eh?")
What do you think about this solution?
We value your feedback to improve our textbook solutions.