0% found this document useful (0 votes)
5 views3 pages

Asmt 1

The document outlines the development of a Java console application for managing student grades, including functionalities for adding students, displaying their grades, calculating average grades, and identifying the highest and lowest grades. It specifies the creation of a Student class and a StudentManager class, detailing their attributes and methods. The main method is designed for user interaction, ensuring input validation and adherence to object-oriented programming principles.

Uploaded by

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

Asmt 1

The document outlines the development of a Java console application for managing student grades, including functionalities for adding students, displaying their grades, calculating average grades, and identifying the highest and lowest grades. It specifies the creation of a Student class and a StudentManager class, detailing their attributes and methods. The main method is designed for user interaction, ensuring input validation and adherence to object-oriented programming principles.

Uploaded by

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

Assignment: Student Grade Management

System
Objective
Develop a Java console application that allows users to manage student grades efficiently. The
system should:

1. Store multiple students with their names and grades.


2. Allow user input to add students.
3. Display all students along with their grades.
4. Calculate and display the average grade of all students.
5. Find and display the highest and lowest grades in the class.

Functional Requirements
1. Student Class (Student)

Create a Student class that represents a student with:

 Instance Variables:
o String name – stores the student’s name.
o int grade – stores the student's grade (0-100).
 Constructor:
o Student(String name, int grade) – initializes the student’s name and grade.
 Method:
o void display() – prints the student's name and grade in "Name: Grade" format.

2. StudentManager Class (StudentManager)

Create a StudentManager class that manages students.

2.1. Fields:

 Student[] students – an array to store multiple Student objects.


 int count – tracks the number of students added.

2.2. Constructor:

 StudentManager(int size) – initializes the students array with a specified size.

2.3. Methods:

✅ void addStudent(String name, int grade):


 Adds a new Student object to the array.
 Ensures students cannot be added if the array is full.

✅ void displayStudents():

 Prints a list of all students using the display() method.

✅ double calculateAverage():

 Computes and returns the average grade of all students.

✅ void findHighestLowest():

 Finds and prints the highest and lowest grades along with the corresponding student
names.

3. Main Class (Main)


Implement the main method to handle user interaction using Scanner.

3.1. Steps in Main Method:

1. Ask the user:


o "Enter the number of students:"
o Store the input as int numStudents.
2. Create an instance of StudentManager with numStudents as the array size.
3. Use a for loop to collect student details:
o Ask for "Enter name for student X:"
o Ask for "Enter grade for student X:" (must be 0-100).
o Call addStudent(name, grade).
4. Call and display:
o displayStudents()
o calculateAverage()
o findHighestLowest()

Non-Functional Requirements
 ✅ The program should handle incorrect inputs (e.g., invalid grades).
 ✅ Must follow OOP principles (separation of concerns, encapsulation).
 ✅ Use loops for input collection and processing.
 ✅ Use arrays to store student objects.
 ✅ The code should be modular (each task handled by a separate method).

Example Run (User Input in Bold)


txt
КопироватьРедактировать
Enter the number of students: **3**

Enter name for student 1: **Alice**


Enter grade for student 1: **85**

Enter name for student 2: **Bob**


Enter grade for student 2: **78**

Enter name for student 3: **Charlie**


Enter grade for student 3: **92**

--- Student List ---


Alice: 85
Bob: 78
Charlie: 92

Average Grade: 85.0


Highest Grade: Charlie - 92
Lowest Grade: Bob - 78

You might also like