0% found this document useful (0 votes)
34 views1 page

Student Grade Manager Java Project

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views1 page

Student Grade Manager Java Project

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.util.

*;

public class StudentGradeManager {


public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Map<String, Integer> studentMarks = new HashMap<>();

System.out.println("🎓 Welcome to Student Grade Management System");

while (true) {
System.out.println("\nChoose an option:");
System.out.println("1. Add Student");
System.out.println("2. View All Students");
System.out.println("3. Exit");
System.out.print("Enter your choice: ");
int choice = scanner.nextInt();
scanner.nextLine(); // consume newline

switch (choice) {
case 1:
System.out.print("Enter student name: ");
String name = scanner.nextLine();
System.out.print("Enter marks (0-100): ");
int marks = scanner.nextInt();
studentMarks.put(name, marks);
System.out.println("✅ Student added successfully!");
break;

case 2:
System.out.println("\n📋 Student Report Cards:");
for (Map.Entry<String, Integer> entry :
studentMarks.entrySet()) {
String grade = getGrade(entry.getValue());
System.out.printf("Name: %s | Marks: %d | Grade: %s\n",
entry.getKey(), entry.getValue(), grade);
}
break;

case 3:
System.out.println("👋 Exiting... Goodbye!");
scanner.close();
return;

default:
System.out.println("❌ Invalid choice. Try again.");
}
}
}

// Grade calculation logic


public static String getGrade(int marks) {
if (marks >= 90) return "A+";
else if (marks >= 80) return "A";
else if (marks >= 70) return "B";
else if (marks >= 60) return "C";
else if (marks >= 50) return "D";
else return "F";
}
}

You might also like