CS 1063 Intro. to Programming
|
Note: After you have worked on the problems below, you can look at Selected Answers.
In Week 8, we had arithmetic operators:
+ / % + -
In Week 10, we added comparison operators:
== > < != >= <=
In Week 11, we added logical operators:
! && ||
assignement operator:
=
increment and decrement operators:
++ --
Week 11 give a large precedence table (do not memorize)
double, int, and boolean
Use the operators above on these
Example: String type
Must not use comparison operators on Strings.
Use the method equals instead of
== !=
Use the method compareTo as a replacement
for all comparison operators
Also use +
to concatenate (tack together) Strings.
See Week 10 and Week 11 lectures for many examples.
| points | Grade |
|---|---|
| greater than 100 | A+ |
| 90 to 100 inclusive | A |
| 80 to 89 inclusive | B |
| 70 to 79 inclusive | C |
| 60 to 79 inclusive | D |
| 0 to 59 inclusive | F |
| less than 0 | Invalid |
You have prepared for this question by having done the labs. The question will be similar to these labs, but simpler. You can also prepare by looking over or working out the two extra review classes in the Week 12 Review: the Triangle class, and the RomanNumeral class. (Note that the switch statement in the answer to the question about the RomanNumeral class in not required. It can easily be done with an extended if-else statement.)