01
Assignment Overview
This assignment focuses on mastering control flow in Java. You'll solve various problems using conditionals and loops, demonstrating your ability to control program execution effectively.
Skills Applied: Operators (2.1), Conditional Statements (2.2), and Loops (2.3) from Module 2.
Operators
Arithmetic, comparison, and logical operators
Conditionals
if/else, switch statements, ternary operator
Loops
for, while, do-while, enhanced for loop
02
Requirements
Part 1: Calculator Program (20 points)
- Create a calculator that performs basic operations (+, -, *, /, %)
- Use switch statement for operation selection
- Handle division by zero gracefully
- Loop until user chooses to exit
Part 2: Number Guessing Game (25 points)
- Generate a random number between 1 and 100
- Allow user to guess with hints (higher/lower)
- Track number of attempts
- Offer option to play again
Part 3: Pattern Printing (15 points)
- Print a pyramid pattern of numbers
- Print a diamond pattern using asterisks
- Use nested loops for pattern generation
Part 4: Grade Calculator (15 points)
- Accept multiple student scores
- Calculate average and assign letter grades
- Display statistics (highest, lowest, average)
03
Submission Guidelines
Folder Structure: Submit all files in a folder named
assignment2_yourname
Required Files:
Calculator.javaGuessingGame.javaPatternPrinter.javaGradeCalculator.javaREADME.txt
Ready to submit? Make sure you've tested all programs!
Submit Now
04
Grading Rubric
| Criteria | Points | Description |
|---|---|---|
| Calculator Program | 20 | All operations work correctly with proper error handling |
| Guessing Game | 25 | Random generation, hints, attempt tracking, replay option |
| Pattern Printing | 15 | Correct patterns using nested loops |
| Grade Calculator | 15 | Accurate calculations and grade assignments |
| Total | 75 |