Quiz1 Grades

Quiz 1 - Java Fundamentals

Duration: 30 minutes
Total Points: 100 points

Instructions

Write a Java program that combines concepts from the first three labs. Your program should demonstrate proper use of:

  • Basic I/O operations (Scanner)
  • Variables and data types
  • Control structures (if/else, loops, switch)
  • String manipulation
  • Mathematical operations
  • Formatted output

Problem: Student Grade Management System (100 points)

Write a complete Java program called GradeManager.java that performs the following tasks:

Requirements:

  1. Student Information Input (15 points)

    • Prompt the user to enter their first name and last name
    • Concatenate them into a full name with proper spacing
    • Display a welcome message using the full name
  2. Grade Collection (20 points)

    • Ask the user to enter grades for 4 subjects: Math, Physics, Chemistry, and English
    • Use appropriate data types (integers are acceptable for grades)
    • Validate that each grade is between 0 and 100 (inclusive)
    • If an invalid grade is entered, display “Invalid grade” and ask for re-entry
  3. Statistical Calculations (25 points)

    • Calculate the total of all grades
    • Calculate the average grade (display with 2 decimal places)
    • Find the highest grade among the 4 subjects
    • Find the lowest grade among the 4 subjects
  4. Grade Classification (20 points)

    • Use a series of if/else statements to determine the letter grade based on the average:
      • A: 90-100
      • B: 80-89
      • C: 70-79
      • D: 60-69
      • F: Below 60
  5. Subject Performance Analysis (10 points)

    • Use a switch statement to identify which subject had the highest grade
    • Display the name of that subject
  6. Formatted Output (10 points)

    • Display all results using proper formatting:
      • Student name
      • Individual grades for each subject
      • Total, average, highest, and lowest grades
      • Letter grade
      • Best performing subject
    • Use printf for numerical formatting where appropriate

Sample Output:

Enter your first name: John
Enter your last name: Smith
Welcome John Smith!

Enter Math grade (0-100): 85
Enter Physics grade (0-100): 92
Enter Chemistry grade (0-100): 78
Enter English grade (0-100): 88

=== GRADE REPORT ===
Student: John Smith
Math: 85
Physics: 92
Chemistry: 78
English: 88

Total: 343
Average: 85.75
Highest: 92
Lowest: 78
Letter Grade: B
Best Subject: Physics

Grading Criteria:

  • Syntax and Compilation (10 points): Program compiles without errors
  • Functionality (60 points): All requirements implemented correctly
  • Code Quality (20 points): Proper variable names, comments, and code organization
  • Input/Output (10 points): Proper user interaction and formatted output

Additional Notes:

  • Remember to import necessary classes (e.g., java.util.Scanner)
  • Close the Scanner object when done
  • Handle edge cases (e.g., all grades are equal)
  • Use meaningful variable names
  • Your code should be well-structured and readable

Time Management Tip: Spend about 5 minutes planning your solution, 20 minutes implementing, and 5 minutes testing and reviewing your code.

Good luck!