Chapter Table of Contents
Ch. 6 Conditionals
Section Table of Contents
Practice
Grade
Create a class called Grade. In the main method, prompt the user to enter a test score as a percent. Then, print out the letter grade that that score would receive.
💻 Template code
✅Solution code
Even or Odd?
Use the modulus operator (%) to check whether an inputted number is even or odd.
💻 Template code
✅ Solution code
Old Enough to Drive?
Create a program called Drive. It should do the following:
- Prompt the user to enter their age
- Create 3 boolean expressions isMinor, isAdult, and isSenior. A person is a minor if they're under 18. They are an adult if they're 18-64 years old. They are a senior if they're 65+.
- Print the age group the user is in.
- Print whether the user can drive. An adult or senior can drive, while a minor cannot.