[go: up one dir, main page]

0% found this document useful (0 votes)
6 views5 pages

task-3

The document outlines Lab Session 3 for implementing a University Management System (HITMS) in Java based on a UML class diagram. It includes objectives such as converting UML diagrams into Java classes, implementing encapsulation, and establishing class relationships. The lab tasks involve implementing core classes like Student, Course, and Department, creating associations between them, and testing the implementation with sample objects.

Uploaded by

rajsurmeda44
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)
6 views5 pages

task-3

The document outlines Lab Session 3 for implementing a University Management System (HITMS) in Java based on a UML class diagram. It includes objectives such as converting UML diagrams into Java classes, implementing encapsulation, and establishing class relationships. The lab tasks involve implementing core classes like Student, Course, and Department, creating associations between them, and testing the implementation with sample objects.

Uploaded by

rajsurmeda44
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/ 5

Lab Session 3

Criterion1 Criterion2 Criterion3 Criterion4 Criterion5 Total

/20

Lab Title: Practice with implementation of class diagram in Java.

1. Problem Statement

Based on the Class Diagram designed in Lab 1, implement the core classes of HITMS (University Management
System) in Java. This lab focuses on translating UML design into actual Java code with proper attributes, methods,
and relationships.

2. Objectives

By the end of this lab, students will be able to:

1. Convert UML class diagrams into Java classes


2. Implement proper encapsulation with private attributes and public methods
3. Establish relationships between classes (associations)
4. Create and test objects in Java

3. Lab Tasks

Task 1: Implement Core Classes

Implement the following classes with proper attributes and methods:

1. Student class with:


o Attributes: studentId, name, email
o Methods: enrollCourse(), viewGrades()
2. Course class with:
o Attributes: courseCode, title, credits
o Methods: addStudent(), displayCourseInfo()
3. Department class with:
o Attributes: deptId, name
o Methods: addFaculty(),

listCourses() Task 2: Implement Relationships

1. Create association between Student and Course:


o A Student can enroll in multiple Courses
o A Course can have multiple Students
2. Create association between Department and Course:
o A Department offers multiple Courses
Task 3: Test Your Implementation

1. Create 2 Student objects


2. Create 3 Course objects
3. Enroll students in courses
4. Display student's enrolled courses

import java.util.jar.Attributes.Name;

class University {
String name;
String address;
String contactNumber;
public void DisplayDetails(){
System.out.println("University: "+name+", Address: "+ address + ", Contact"+ contactNumber);
}
}
class Department{
String name;
String code ;

public void DisplayDetails(){


System.out.println("Department: "+name+", code"+ code);
}
}
class Student{
String studentID;
String name;
String email;
String phone ;
String dateOfBirth;
void DisplayDetails(){
System.out.println("Student: "+ name +", ID: "+studentID+", Email: "+email );
}
}
class Professor{
String professorID;
String name;
String email;
String phone ;
String specialization;
public void DisplayDetails(){
System.out.println("Professor: "+name+", Specialization: "+ specialization);
}
}
class Course {
String courseID;
String title;
int credits;
public void DisplayDetails (){
System.out.println("Course: "+ title + "Credits: "+ credits);
}
}
class Classroom{
String roomNumber;
int capacity;
String location ;
public void DisplayDetails(){
System.out.println("Class_Room: "+ roomNumber+", Capacity "+ capacity+ ", location: "+location);
}
}
class Subject{
String subbjectID;
String name;
String type;
public void DisplayDetails(){
System.out.println("Subject: "+name+ ", Type: "+type);
}
}
class Lecture {
String lecture_ID ;
String Topic ;
String Date;
int Duration;
public void DisplayDetails(){
System.out.println("Lecture: "+ Topic+ ", Date: "+ Date);
}
}
class Assignment{
String assignmentID;
String title;
String Deadline;
public void DisplayDetails(){
System.out.println("Assignment: "+title+", Deadline"+ Deadline);
}
}
class Submission{
String submissionID;
String dateSubmittedID;
String grade;
public void DisplayDetails(){
System.out.println("Submission: "+ submissionID +", Grade: "+ grade);
}
}
class Exam {
String examID;
String type;
String date;
public void DisplayDetails(){
System.out.println("Exam_Type: "+ type+ ", Date: "+ date);
}

}
class Result {
String resultID;
Float score ;
String grade;
public void DisplayDetails(){
System.out.println("Results: Score = "+ score + ", Grade = "+ grade);
}
}
class Library {
String bookID;
String name;
String location;
public void DisplayDetails(){
System.out.println("Library: "+ name + ", Location: "+location);
}
}
class Book{
String LibrianID;
String name;
String email;
public void DisplayDetails(){
System.out.println("librarian: "+ name+ ", Email: "+ email);
}
}
class Enrollment{
String enrollment;
String semester;
String date;
public void DisplayDetails(){
System.out.println("Enrollment: "+ enrollment + ", Semester: "+ semester);
}
}
class Staff{
String StaffID;
String name;
String role;
float salary;
public void DisplayDetails(){
System.out.println("Staff: "+ name+ ", Role: "+ role);
}}
class Admin{
String admainID;
String username;
String password;
public void DisplayDetails(){
System.out.println("Admin Username: "+ username);
}
}
class Schedule {
String scheduleID;
String time ;
String day;
public void DisplayDetails(){
System.out.println("Schedule: "+ day + " at "+ time);
}
}
class Attendance{
String attendanceID;
String status;
String date;
public void DisplayDetails(){
System.out.println("Attendance on "+date+ ": "+status);
}
}
class Transcript{
String transcript;
float GPA;
public void DisplayDetails(){
System.out.println("Transcript_GPA: "+GPA);
}
}
class DepartmentHead{
String headID;
String name;
public void DisplayDetails(){
System.out.println("Department Head: "+ name);
}
}
class Hostel {
String hostelID;
String name;
int capacity;
public void DisplayDetails(){
System.out.println("Hostel: "+name + ", Capacity: "+ capacity);
}
}
public class Main{
public static void main(String[] args){
University uni = new University();
uni.name = "Hitms_University";
uni.address = "Hyderabad";
uni.contactNumber = "9253723627";
uni.DisplayDetails();
Department dept = new Department();
dept.name = "Computer_Science";
dept.code = " BS CS";
dept.DisplayDetails();
Student student = new Student();
student.studentID = "24BSCS115";
student.name = "Rajesh Kumar";
student.email = "rajsurmeda@gmail.com";
student.DisplayDetails();
Course course = new Course();
course.title = " OOP in Java ";
course.credits = 3;
course.DisplayDetails();
Professor prof = new Professor();
prof.name = "Azhar Ali";
prof.specialization = "Software Engineering";
prof.DisplayDetails();
}
}
OUT_PUT :

University: Hitms_University, Address: Hyderabad, Contact9253723627


Department: Computer_Science, code BS CS
Student: Rajesh Kumar, ID: 24BSCS115, Email: rajsurmeda@gmail.com
Course: OOP in Java Credits: 3
Professor: Azhar Ali, Specialization: Software Engineering

Rajesh Kumar
Roll_Number: BSCS115

You might also like