0% found this document useful (0 votes)
0 views4 pages

Ws 4

The document outlines a workshop for creating a Java application to manage student course enrollments and grades using object-oriented programming. It includes requirements for designing class hierarchies for courses and students, as well as behaviors for entering courses and students, and displaying reports. The application should utilize collections for data management and generate reports based on student performance in their enrolled courses.

Uploaded by

Thanh Tùng Lê
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views4 pages

Ws 4

The document outlines a workshop for creating a Java application to manage student course enrollments and grades using object-oriented programming. It includes requirements for designing class hierarchies for courses and students, as well as behaviors for entering courses and students, and displaying reports. The application should utilize collections for data management and generate reports based on student performance in their enrolled courses.

Uploaded by

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

Workshop 4: Student-Course Enrollment & Grade Analyzer

Description
In this workshop, you will create a Java application to manage students and their course
enrollments, using object-oriented programming principles:
- Use inheritance and polymorphism to model different student types.
- Allow users to input a dynamic list of courses.
- Track which course each student is enrolled in using a course code reference.
- Use collections to manage data.
- Generate a report that displays all students grouped by course, showing pass/fail status
and letter grades.

Requirements
1. Create a new Java project named Workshop4. The main class should be
workshop4.Workshop4

2. Design a class hierarchy as follows:

Class Course
Course
- code: String
- name: String
+ Course(code, name)
+ getCode(): String
+ getName(): String
+ setCode(String code): void
+ setName(String name): void
Base Class: Student
Student
-name: String
-age: int
-code: String
-grade: int
+Student(name, age, code, grade)
+getName(): String
+getAge(): int
+getCode(): String
+getGrade(): int
+getCourse(): Course
+setName(name: String): void
+setAge(age: int): void
+setCode(code: String): void
+setGrade(grade: int): void
+setCourse(course: Course): void
+isValidCode(): boolean
+isPassed(): boolean
+getLetterGrade(): String

Subclass: UndergraduateStudent inherits Student

UndergraduateStudent

+isPassed(): Boolean // grade >= 50


+getLetterGrade(): String

Subclass: GraduateStudent inherits Student


GraduateStudent

+isPassed(): boolean // grade >= 70


+getLetterGrade(): String

Behaviors

Step 1: Enter Courses


1. Ask the user how many courses to enter.
2. For each course:
- Prompt for course code (e.g., CS101)
- Prompt for course name
3. Store all courses in a HashMap<String, Course> for easy lookup by code.

Step 2: Enter Students


1. Ask the user how many students to enter.
2. For each student:
- Ask if they are Undergraduate (U) or Graduate (G)
- Input: Name, Age, Student Code, Grade
- Show list of available course codes and names
- Ask user to enter course code for the student to enroll in
- Create student object and set courseCode field
- Add student to List<Student>
Note: Skip students with invalid course codes.

Step 3: Display Report


1. For each course in the course list:
- Find students whose courseCode matches the course code.
- If found:
- Print course info
- For each student:
- Print: name, type, grade, letter grade, pass/fail

Sample Output
Enter number of courses: 2
Course 1 code: CS101
Course 1 name: Intro to Programming
Course 2 code: CS202
Course 2 name: Data Structures

Enter number of students: 2

Enter student 1 type (U=Undergraduate, G=Graduate): U


Name: Alice
Age: 20
Code: SE12345
Grade: 65
Available courses:
CS101 - Intro to Programming
CS202 - Data Structures
Enter course code to enroll: CS101

Enter student 2 type (U=Undergraduate, G=Graduate): G


Name: Bob
Age: 24
Code: SE54321
Grade: 68
Enter course code to enroll: CS202

=== Students in Course: CS101 - Intro to Programming ===


Alice (Undergraduate) - Grade: 65 (D) - PASSED

=== Students in Course: CS202 - Data Structures ===


Bob (Graduate) - Grade: 68 (C) - FAILED

Submission Instructions
- Zip your entire project folder (with src and any .java files)
- File name format: StudentID_Name_Workshop4.zip
- Submit it to your LMS before the deadline

You might also like