You are on page 1of 5

Java SE 8 Programming Language

Lab G ui des
Lab Guides Mr Tuan cat

Contents
Unit 3: Classes and Objects............................................................................................................. 3
Lab Guide 1: Class và Object.......................................................................................................3
Objectives:.................................................................................................................................... 3
Problem Descriptions:................................................................................................................... 3
Guidelines:.................................................................................................................................... 3
Lab Guide 2: Xây dựng thông tin quản lý các trường đại học.......................................................5

Internal use 2/5


Lab Guides Mr Tuan cat
CODE: JPL.S.L002
TYPE: SHORT
DURATION: 30 MINUTES

Unit 3: Classes and Objects


Lab Guide 1: Class và Object
Objectives:

 Thực hành với class và object.


Problem Descriptions:

Create a new package named lab2:


The Subject class:
 Instance variables:
o mainSubject: tên của môn học

o teach method: the collegename that teacher do work

 Constructor:
 public Subject (): A default constructor, it should initialize the attribute to null or 0
 public Subject (String mainSubject): A constructor với thuộc tính tham số mainSubject để khởi tạo
Subject
 Instance methods:
 Getter/Setter methods: are used to get/set the value
The Teacher class that extends Teacher:
 Instance variables:
o name: tên giáo viên

o collegeName: tên trường học

o Subject: về thông tin của môn học

 Constructor:
 public Teacher (): A default constructor, it should initialize the attribute to null or 0 )
 public Teacher (String name, String collegeName, Subject subject): A constructor with parameters, it
creates the teacher object by setting the three fields to the passed values.
 Instance methods:
 Getter/Setter methods: are used to get/set the value
 public void teach(String content)
Guidelines:

Project struture:

Internal use 3/5


Lab Guides Mr Tuan cat

Teacher class:

Subject class:

Results:

Internal use 4/5


Lab Guides Mr Tuan cat

Lab Guide 2: Xây dựng thông tin quản lý các trường đại học
 Lưu trữ thông tin quản lý các trường đại học
 Giáo viên có thể tham gia giảng dạy tại nhiều trường đại học

Internal use 5/5

You might also like