Soumettre la recherche
Mettre en ligne
662305 09
•
1 j'aime
•
729 vues
Nitigan Nakjuatong
Suivre
ใบงานที่ 9 ครับ
Lire moins
Lire la suite
Formation
Technologie
Divertissement et humour
Signaler
Partager
Signaler
Partager
1 sur 13
Télécharger maintenant
Télécharger pour lire hors ligne
Recommandé
The Ring programming language version 1.4.1 book - Part 18 of 31
The Ring programming language version 1.4.1 book - Part 18 of 31
Mahmoud Samir Fayed
Mythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDB
MongoDB
Lecture 4: Data Types
Lecture 4: Data Types
Eelco Visser
java experiments and programs
java experiments and programs
Karuppaiyaa123
WorkingWithSlick2.1.0
WorkingWithSlick2.1.0
Knoldus Inc.
mobl
mobl
Eelco Visser
The Ring programming language version 1.2 book - Part 22 of 84
The Ring programming language version 1.2 book - Part 22 of 84
Mahmoud Samir Fayed
File System Operations
File System Operations
G.C Reddy
Recommandé
The Ring programming language version 1.4.1 book - Part 18 of 31
The Ring programming language version 1.4.1 book - Part 18 of 31
Mahmoud Samir Fayed
Mythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDB
MongoDB
Lecture 4: Data Types
Lecture 4: Data Types
Eelco Visser
java experiments and programs
java experiments and programs
Karuppaiyaa123
WorkingWithSlick2.1.0
WorkingWithSlick2.1.0
Knoldus Inc.
mobl
mobl
Eelco Visser
The Ring programming language version 1.2 book - Part 22 of 84
The Ring programming language version 1.2 book - Part 22 of 84
Mahmoud Samir Fayed
File System Operations
File System Operations
G.C Reddy
Hidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard Library
doughellmann
Basic crud operation
Basic crud operation
zarigatongy
The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196
Mahmoud Samir Fayed
c++ boost and STL
c++ boost and STL
COMAQA.BY
The Ring programming language version 1.9 book - Part 46 of 210
The Ring programming language version 1.9 book - Part 46 of 210
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 39 of 212
The Ring programming language version 1.10 book - Part 39 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.5.2 book - Part 32 of 181
The Ring programming language version 1.5.2 book - Part 32 of 181
Mahmoud Samir Fayed
Java OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - Collection
OUM SAOKOSAL
Qtp Imp Script Examples
Qtp Imp Script Examples
User1test
The Ring programming language version 1.6 book - Part 38 of 189
The Ring programming language version 1.6 book - Part 38 of 189
Mahmoud Samir Fayed
The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31
Mahmoud Samir Fayed
Qtp best tutorial
Qtp best tutorial
Ramu Palanki
Chapter ii(oop)
Chapter ii(oop)
Chhom Karath
Zend Framework 1 + Doctrine 2
Zend Framework 1 + Doctrine 2
Ralph Schindler
What makes a good bug report?
What makes a good bug report?
Rahul Premraj
Java OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBC
OUM SAOKOSAL
The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210
Mahmoud Samir Fayed
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rick Copeland
4 gouping object
4 gouping object
Robbie AkaChopa
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31
Mahmoud Samir Fayed
Lowering the drinking age
Lowering the drinking age
mylynn89
Lowering the drinking age
Lowering the drinking age
mylynn89
Contenu connexe
Tendances
Hidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard Library
doughellmann
Basic crud operation
Basic crud operation
zarigatongy
The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196
Mahmoud Samir Fayed
c++ boost and STL
c++ boost and STL
COMAQA.BY
The Ring programming language version 1.9 book - Part 46 of 210
The Ring programming language version 1.9 book - Part 46 of 210
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 39 of 212
The Ring programming language version 1.10 book - Part 39 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.5.2 book - Part 32 of 181
The Ring programming language version 1.5.2 book - Part 32 of 181
Mahmoud Samir Fayed
Java OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - Collection
OUM SAOKOSAL
Qtp Imp Script Examples
Qtp Imp Script Examples
User1test
The Ring programming language version 1.6 book - Part 38 of 189
The Ring programming language version 1.6 book - Part 38 of 189
Mahmoud Samir Fayed
The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31
Mahmoud Samir Fayed
Qtp best tutorial
Qtp best tutorial
Ramu Palanki
Chapter ii(oop)
Chapter ii(oop)
Chhom Karath
Zend Framework 1 + Doctrine 2
Zend Framework 1 + Doctrine 2
Ralph Schindler
What makes a good bug report?
What makes a good bug report?
Rahul Premraj
Java OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBC
OUM SAOKOSAL
The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210
Mahmoud Samir Fayed
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rick Copeland
4 gouping object
4 gouping object
Robbie AkaChopa
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31
Mahmoud Samir Fayed
Tendances
(20)
Hidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard Library
Basic crud operation
Basic crud operation
The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196
c++ boost and STL
c++ boost and STL
The Ring programming language version 1.9 book - Part 46 of 210
The Ring programming language version 1.9 book - Part 46 of 210
The Ring programming language version 1.10 book - Part 39 of 212
The Ring programming language version 1.10 book - Part 39 of 212
The Ring programming language version 1.5.2 book - Part 32 of 181
The Ring programming language version 1.5.2 book - Part 32 of 181
Java OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - Collection
Qtp Imp Script Examples
Qtp Imp Script Examples
The Ring programming language version 1.6 book - Part 38 of 189
The Ring programming language version 1.6 book - Part 38 of 189
The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31
Qtp best tutorial
Qtp best tutorial
Chapter ii(oop)
Chapter ii(oop)
Zend Framework 1 + Doctrine 2
Zend Framework 1 + Doctrine 2
What makes a good bug report?
What makes a good bug report?
Java OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBC
The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
4 gouping object
4 gouping object
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31
En vedette
Lowering the drinking age
Lowering the drinking age
mylynn89
Lowering the drinking age
Lowering the drinking age
mylynn89
Presentacion nomina y pss
Presentacion nomina y pss
luisacomercio2
662305 LAB12
662305 LAB12
Nitigan Nakjuatong
El comite sindical 2001
El comite sindical 2001
Felipe VALDERRAMA DIAZ
Control structure
Control structure
Nitigan Nakjuatong
Things_you_dont_see_every_day
Things_you_dont_see_every_day
Janet Hill
Chapter 1 PowerPoint
Chapter 1 PowerPoint
Radhika Prout
662305 10
662305 10
Nitigan Nakjuatong
Things_you_dont_see_every_day
Things_you_dont_see_every_day
Janet Hill
Instructional tech best_practices
Instructional tech best_practices
Radhika Prout
Set putty to use numeric keyboard in pico
Set putty to use numeric keyboard in pico
Nitigan Nakjuatong
Karma 2012
Karma 2012
Janet Hill
CENTER OF THE BIBLE
CENTER OF THE BIBLE
Janet Hill
662305 11
662305 11
Nitigan Nakjuatong
Narendra murkumbi
Narendra murkumbi
Srinivas Mittapelli
Derivatives in India
Derivatives in India
Srinivas Mittapelli
Investment banking
Investment banking
Srinivas Mittapelli
Oppression and Management
Oppression and Management
Srinivas Mittapelli
En vedette
(19)
Lowering the drinking age
Lowering the drinking age
Lowering the drinking age
Lowering the drinking age
Presentacion nomina y pss
Presentacion nomina y pss
662305 LAB12
662305 LAB12
El comite sindical 2001
El comite sindical 2001
Control structure
Control structure
Things_you_dont_see_every_day
Things_you_dont_see_every_day
Chapter 1 PowerPoint
Chapter 1 PowerPoint
662305 10
662305 10
Things_you_dont_see_every_day
Things_you_dont_see_every_day
Instructional tech best_practices
Instructional tech best_practices
Set putty to use numeric keyboard in pico
Set putty to use numeric keyboard in pico
Karma 2012
Karma 2012
CENTER OF THE BIBLE
CENTER OF THE BIBLE
662305 11
662305 11
Narendra murkumbi
Narendra murkumbi
Derivatives in India
Derivatives in India
Investment banking
Investment banking
Oppression and Management
Oppression and Management
Similaire à 662305 09
Fee managment system
Fee managment system
fairy9912
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswar
ROHIT JAISWAR
OBJECTS IN Object Oriented Programming .ppt
OBJECTS IN Object Oriented Programming .ppt
SaadAsim11
Code Smells y Refactoring o haciendo que nuestro codigo huela (y se vea) mejo...
Code Smells y Refactoring o haciendo que nuestro codigo huela (y se vea) mejo...
.NET Conf UY
OOP Lab Report.docx
OOP Lab Report.docx
ArafatSahinAfridi
Session 08 - OOP with Java - continued
Session 08 - OOP with Java - continued
PawanMM
Hello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdf
irshadkumar3
Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018
Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018
Codemotion
@author public class Person{ String sname, .pdf
@author public class Person{ String sname, .pdf
aplolomedicalstoremr
Java весна 2013 лекция 2
Java весна 2013 лекция 2
Technopark
Inheritance in C++.ppt
Inheritance in C++.ppt
instaface
Java programs
Java programs
jojeph
6. static keyword
6. static keyword
Indu Sharma Bhardwaj
[PL] O klasycznej, programistycznej elegancji
[PL] O klasycznej, programistycznej elegancji
Jakub Marchwicki
#살아있다 #자프링외길12년차 #코프링2개월생존기
#살아있다 #자프링외길12년차 #코프링2개월생존기
Arawn Park
JavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovy
Yasuharu Nakano
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
Darwin Durand
Create methods to_insert
Create methods to_insert
NayanBakhadyo
Dotnet 18
Dotnet 18
dhruvesh718
20160616技術會議
20160616技術會議
Jason Kuan
Similaire à 662305 09
(20)
Fee managment system
Fee managment system
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswar
OBJECTS IN Object Oriented Programming .ppt
OBJECTS IN Object Oriented Programming .ppt
Code Smells y Refactoring o haciendo que nuestro codigo huela (y se vea) mejo...
Code Smells y Refactoring o haciendo que nuestro codigo huela (y se vea) mejo...
OOP Lab Report.docx
OOP Lab Report.docx
Session 08 - OOP with Java - continued
Session 08 - OOP with Java - continued
Hello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdf
Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018
Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018
@author public class Person{ String sname, .pdf
@author public class Person{ String sname, .pdf
Java весна 2013 лекция 2
Java весна 2013 лекция 2
Inheritance in C++.ppt
Inheritance in C++.ppt
Java programs
Java programs
6. static keyword
6. static keyword
[PL] O klasycznej, programistycznej elegancji
[PL] O klasycznej, programistycznej elegancji
#살아있다 #자프링외길12년차 #코프링2개월생존기
#살아있다 #자프링외길12년차 #코프링2개월생존기
JavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovy
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
Create methods to_insert
Create methods to_insert
Dotnet 18
Dotnet 18
20160616技術會議
20160616技術會議
Plus de Nitigan Nakjuatong
วิธีการกำหนดสิทธิให้กับ Directory
วิธีการกำหนดสิทธิให้กับ Directory
Nitigan Nakjuatong
Applet 7 image_j_panel
Applet 7 image_j_panel
Nitigan Nakjuatong
662305 LAB13
662305 LAB13
Nitigan Nakjuatong
Applet 5 class_inheritance
Applet 5 class_inheritance
Nitigan Nakjuatong
Applet 7 image_j_panel
Applet 7 image_j_panel
Nitigan Nakjuatong
Applet 6 mouse_keyboard
Applet 6 mouse_keyboard
Nitigan Nakjuatong
Applet 5 class_inheritance
Applet 5 class_inheritance
Nitigan Nakjuatong
Applet 4 class_composition
Applet 4 class_composition
Nitigan Nakjuatong
Applet 3 design_class_composition
Applet 3 design_class_composition
Nitigan Nakjuatong
662305 08
662305 08
Nitigan Nakjuatong
Applet 2 container and action_listener
Applet 2 container and action_listener
Nitigan Nakjuatong
662305 Lab7new
662305 Lab7new
Nitigan Nakjuatong
New Assingment3 array2D
New Assingment3 array2D
Nitigan Nakjuatong
Assingment3 array2 d
Assingment3 array2 d
Nitigan Nakjuatong
Lab 6 new
Lab 6 new
Nitigan Nakjuatong
Array2D
Array2D
Nitigan Nakjuatong
Array
Array
Nitigan Nakjuatong
Method part2
Method part2
Nitigan Nakjuatong
Method JAVA
Method JAVA
Nitigan Nakjuatong
Putty basic setting
Putty basic setting
Nitigan Nakjuatong
Plus de Nitigan Nakjuatong
(20)
วิธีการกำหนดสิทธิให้กับ Directory
วิธีการกำหนดสิทธิให้กับ Directory
Applet 7 image_j_panel
Applet 7 image_j_panel
662305 LAB13
662305 LAB13
Applet 5 class_inheritance
Applet 5 class_inheritance
Applet 7 image_j_panel
Applet 7 image_j_panel
Applet 6 mouse_keyboard
Applet 6 mouse_keyboard
Applet 5 class_inheritance
Applet 5 class_inheritance
Applet 4 class_composition
Applet 4 class_composition
Applet 3 design_class_composition
Applet 3 design_class_composition
662305 08
662305 08
Applet 2 container and action_listener
Applet 2 container and action_listener
662305 Lab7new
662305 Lab7new
New Assingment3 array2D
New Assingment3 array2D
Assingment3 array2 d
Assingment3 array2 d
Lab 6 new
Lab 6 new
Array2D
Array2D
Array
Array
Method part2
Method part2
Method JAVA
Method JAVA
Putty basic setting
Putty basic setting
Dernier
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
iammrhaywood
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
Thiyagu K
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
TechSoup
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
RAM LAL ANAND COLLEGE, DELHI UNIVERSITY.
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
Thiyagu K
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
TechSoup
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
EduSkills OECD
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
TeacherCyreneCayanan
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
dawncurless
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
Dr. Mazin Mohamed alkathiri
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
agholdier
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Denish Jangid
psychiatric nursing HISTORY COLLECTION .docx
psychiatric nursing HISTORY COLLECTION .docx
PoojaSen20
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University of Engineering & Technology, Jamshoro
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
VishalSingh1417
Dernier
(20)
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
psychiatric nursing HISTORY COLLECTION .docx
psychiatric nursing HISTORY COLLECTION .docx
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
662305 09
1.
บทที่ 9 การออกแบบ
Class แบบ Composition และใช้ งาน Garbage Collection การออกแบบและสร้าง Class แบบ Composition เพื่อเก็บข้อมูลการลงทะเบียน โดยมีการออกแบบ Class ตาม Class Diagram ดงน้ ี ั Subject - SubjectCode : String - SubjectName : String - SubjectCredit : int + Subject() + Subject(String Code, String Name, int Credit) + setSubjectCode(String Code) : void + setSubjectName(String Name) : void + setSubjectCredit(int Credit): void + getSubjectCode() : String + getSubjectName() : String + getSubjectCredit() : int + toString() : String Student - StudentCode : String - StudentName : String - StudentSurName : String + Student() + Student(String Code, String Name, String SurName) + setStudentCode(String Code) : void + setStudentName(String Name) : void + setStudentSurName(String SurName): void + getStudentCode() : String + getStudentName() : String + getStudentSurName() : String + toString() : String Register - std : Student - sub[] : Subject - max : int - count : int = -1 + Register() + Register(Student std , int n) - createSubject(int n) : void + setStudent(Student std) : void + setSubject(Subject sub) : void + setStudentSurName(String SurName): void + setSubject(Subject sub, int n) : void + getStudent() : String + getSubject(int n) : String 662305 Information Technology Laboratory II- Chapter 9 หน ้า 1 จาก 13
2.
Subject
Register Student การทดลองที่ 9-1 // File Name : Subject.java public class Subject { private String SubjectCode; private String SubjectName; private int SubjectCredit; /** Creates a new instance of Subject */ public Subject() { setSubjectCode(""); setSubjectName(""); setSubjectCredit(0); } public Subject(String Code, String Name, int Credit) { setSubjectCode(Code); setSubjectName(Name); setSubjectCredit(Credit); } public void setSubjectCode(String Code) { SubjectCode = Code; } public void setSubjectName(String Name) { SubjectName = Name; } public void setSubjectCredit(int Credit) { SubjectCredit = Credit; } public String getSubjectCode() { return (SubjectCode); } public String getSubjectName() { return(SubjectName); } public int getSubjectCredit() { return(SubjectCredit); } 662305 Information Technology Laboratory II- Chapter 9 หน ้า 2 จาก 13
3.
public String toString()
{ String str = ""; str = getSubjectCode()+" "+getSubjectName()+" "; str += getSubjectCredit(); return(str); } } // File Name : Student.java public class Student { String StudentCode; String StudentName; String StudentSurName; /** Creates a new instance of Student */ public Student() { setStudentCode(""); setStudentName(""); setStudentSurName(""); } public Student(String Code, String Name, String SurName) { setStudentCode(Code); setStudentName(Name); setStudentSurName(SurName); } public void setStudentCode(String Code) { StudentCode = Code; } public void setStudentName(String Name) { StudentName = Name; } public void setStudentSurName(String SurName) { StudentSurName = SurName; } public String getStudentCode() { return(StudentCode); } public String getStudentName() { return(StudentName); } public String getStudentSurName() { return(StudentSurName); } 662305 Information Technology Laboratory II- Chapter 9 หน ้า 3 จาก 13
4.
public String toString()
{ String str = ""; str = getStudentCode()+" "+getStudentName()+" "; str += getStudentSurName(); return(str); } } // File Name : Register.java public class Register { private Student std; private Subject sub[]; private int max, count = -1; /** Creates a new instance of Register */ public Register() { std = new Student(); max = 0; } public Register(Student std, int n) { this.std = std; max = n; createSubject(max); } private void createSubject(int n) { sub = new Subject[n]; } public void setStudent(Student std) { this.std = std; } public void setSubject(Subject sub) { this.sub[++count] = sub; } public void setSubject(Subject sub, int n) { this.sub[n] = sub; } public String getStudent() { return(std.toString()); } public String getSubject(int n) { return(sub[n].toString()); } } 662305 Information Technology Laboratory II- Chapter 9 หน ้า 4 จาก 13
5.
// File Name
: Lab9_1.java import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Lab9_1 extends JApplet implements ActionListener { Student std[]; Subject sub[]; String studentStr[], subjectStr[]; Container container; JComboBox stdCombo, subCombo; JLabel stdLabel, subLabel; JButton addstdBtn, addsubBtn, saveBtn, clearBtn, cancleBtn; JTextField stdText; JTextArea subTextArea; JScrollPane subScroll; Register reg; int count = 0; /** Creates a new instance of Lab9_1 */ public Lab9_1() { initStudent(); initSubject(); initGui(); reg = new Register(new Student(), 5); } public void initStudent() { std = new Student[3]; studentStr = new String[3]; std[0] = new Student("5066260010","AAAAA","BBBBBBBBBBB"); std[1] = new Student("5066260024","DDDDD","GGGGGGGGGG"); std[2] = new Student("5066260035","HHHHH","KKKKKKKKKKK"); studentStr[0] = std[0].toString(); studentStr[1] = std[1].toString(); studentStr[2] = std[2].toString(); } public void initSubject() { sub = new Subject[5]; subjectStr = new String[5]; sub[0] = new Subject("662305","IT Laboratory II", 1); sub[1] = new Subject("662309","Data Structure", 3); sub[2] = new Subject("662310","Database System", 3); sub[3] = new Subject("662317","Data Communication", 3); sub[4] = new Subject("662327", "Advanced Computer Programming", 3); subjectStr[0] = sub[0].toString(); subjectStr[1] = sub[1].toString(); subjectStr[2] = sub[2].toString(); subjectStr[3] = sub[3].toString(); subjectStr[4] = sub[4].toString(); } 662305 Information Technology Laboratory II- Chapter 9 หน ้า 5 จาก 13
6.
public void initGui()
{ container = getContentPane(); container.setLayout(new FlowLayout()); stdLabel = new JLabel("Select Student : "); container.add(stdLabel); stdCombo = new JComboBox( studentStr ); stdCombo.setMaximumRowCount(3); container.add(stdCombo); addstdBtn = new JButton("Add Student"); addstdBtn.addActionListener(this); container.add(addstdBtn); stdText = new JTextField(40); stdText.setEditable(false); container.add(stdText); subLabel = new JLabel("Select Subject : "); container.add(subLabel); subCombo = new JComboBox( subjectStr ); subCombo.setMaximumRowCount(5); container.add(subCombo); addsubBtn = new JButton("Add Subject"); addsubBtn.setEnabled(false); addsubBtn.addActionListener(this); container.add(addsubBtn); subTextArea = new JTextArea(5,40); subTextArea.setEditable(false); subScroll = new JScrollPane(subTextArea); container.add(subScroll); saveBtn = new JButton(" Save "); saveBtn.setEnabled(false); saveBtn.addActionListener(this); container.add(saveBtn); cancleBtn = new JButton(" Cancle "); cancleBtn.setEnabled(false); cancleBtn.addActionListener(this); container.add(cancleBtn); } public void actionPerformed(ActionEvent event) { if (event.getSource() == addstdBtn) { int n = stdCombo.getSelectedIndex(); stdText.setText(std[n].toString()); reg.setStudent(std[n]); addstdBtn.setEnabled(false); addsubBtn.setEnabled(true); saveBtn.setEnabled(true); cancleBtn.setEnabled(true); } else if (event.getSource() == addsubBtn) { int n = subCombo.getSelectedIndex(); subTextArea.append(sub[n].toString()+"n"); 662305 Information Technology Laboratory II- Chapter 9 หน ้า 6 จาก 13
7.
reg.setSubject(sub[n], count);
count++; if (count == 5 ) addsubBtn.setEnabled(false); } else if (event.getSource() == saveBtn) { String output=""; output = "Student :" + reg.getStudent(); output += "nSubject:n"; for(int n = 0 ; n < count; n++) output += reg.getSubject(n) + "n"; JOptionPane.showMessageDialog(this, output, "Registration Data",JOptionPane.INFORMATION_MESSAGE); resetBtn(); } else if (event.getSource() == cancleBtn) { stdText.setText(""); subTextArea.setText(""); count = 0; resetBtn(); } } public void resetBtn() { addstdBtn.setEnabled(true); addsubBtn.setEnabled(false); saveBtn.setEnabled(false); cancleBtn.setEnabled(false); stdText.setText(""); subTextArea.setText(""); } public void init( ) { Lab9_1 lab9_1 = new Lab9_1(); } } ผลลัพธ์ 662305 Information Technology Laboratory II- Chapter 9 หน ้า 7 จาก 13
8.
การทดลองที่ 9-2
SubjectNew - SubjectCode : String - SubjectName : String - SubjectCredit : int - static count : int + SubjectNew() + SubjectNew(String Code, String Name, int Credit) + SubjectNew( SubjectNew sub) + setSubjectCode(String Code) : void + setSubjectName(String Name) : void + setSubjectCredit(int Credit): void + getSubjectCode() : String + getSubjectName() : String + getSubjectCredit() : int # finalize() : void + static getCount() : int + toString() : String // File Name : SubjectNew.java public class SubjectNew { private String SubjectCode; private String SubjectName; private int SubjectCredit; private static int count = 0; /** Creates a new instance of Subject */ public SubjectNew() { setSubjectCode(""); setSubjectName(""); setSubjectCredit(0); count++; } 662305 Information Technology Laboratory II- Chapter 9 หน ้า 8 จาก 13
9.
public SubjectNew(String Code,
String Name, int Credit) { setSubjectCode(Code); setSubjectName(Name); setSubjectCredit(Credit); count++; } public SubjectNew( SubjectNew sub) { setSubjectCode(sub.getSubjectCode()); setSubjectName(sub.getSubjectName()); setSubjectCredit(sub.getSubjectCredit()); count++; } public void setSubjectCode(String Code) { SubjectCode = Code; } public void setSubjectName(String Name) { SubjectName = Name; } public void setSubjectCredit(int Credit) { SubjectCredit = Credit; } public String getSubjectCode() { return (SubjectCode); } public String getSubjectName() { return(SubjectName); } public int getSubjectCredit() { return(SubjectCredit); } protected void finalize() { count--; } public static int getCount() { return(count); } public String toString() { String str = ""; str = getSubjectCode()+" "+getSubjectName()+" "; str += getSubjectCredit(); return(str); } } 662305 Information Technology Laboratory II- Chapter 9 หน ้า 9 จาก 13
10.
// File Name
: Lab9_2.java import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Lab9_2 extends JApplet implements ActionListener { SubjectNew sub[]; Container container; JComboBox stdCombo, subCombo; JLabel codeLabel, nameLabel,creditLabel; JButton addBtn, editBtn, deleteBtn, showBtn, clearBtn; JTextField codeText, nameText, creditText, statusText; JTextArea subTextArea; JScrollPane subScroll; /** Creates a new instance of Lab9_2 */ public Lab9_2() { initGui(); sub = new SubjectNew[10]; statusText.setText("Number Object : "+ SubjectNew.getCount()); } public Lab9_2(int max) { initGui(); sub = new SubjectNew[max]; statusText.setText("Number Object : "+ SubjectNew.getCount()); } public void initGui() { container = getContentPane(); container.setLayout(new FlowLayout()); codeLabel = new JLabel(" Subject Code : "); container.add(codeLabel); codeText = new JTextField(10); container.add(codeText); container.add(new JLabel(" ")); nameLabel = new JLabel(" Subject Name : "); container.add(nameLabel); nameText = new JTextField(20); container.add(nameText); creditLabel = new JLabel("Subject Credit : "); container.add(creditLabel); creditText = new JTextField(5); container.add(creditText); container.add(new JLabel(" ")); addBtn = new JButton("Add"); addBtn.addActionListener(this); container.add(addBtn); editBtn = new JButton("Edit"); editBtn.addActionListener(this); container.add(editBtn); 662305 Information Technology Laboratory II- Chapter 9 หน ้า 10 จาก 13
11.
deleteBtn = new
JButton("Delete"); deleteBtn.addActionListener(this); container.add(deleteBtn); showBtn = new JButton("Show"); showBtn.addActionListener(this); container.add(showBtn); clearBtn = new JButton("Clear"); clearBtn.addActionListener(this); container.add(clearBtn); subTextArea = new JTextArea(8,25); subTextArea.setEditable(false); subScroll = new JScrollPane(subTextArea); container.add(subScroll); statusText = new JTextField(30); statusText.setEnabled(false); container.add(statusText); } public void actionPerformed(ActionEvent event) { if (event.getSource() == addBtn) { if (SubjectNew.getCount() == sub.length) { JOptionPane.showMessageDialog( this, "Array full , can not add", "Message", JOptionPane.INFORMATION_MESSAGE); return; } int pos = CheckArrayEmpty(); int n = Integer.parseInt(creditText.getText()); sub[ pos ] = new SubjectNew( codeText.getText(), nameText.getText(), n); subTextArea.setText( readString( sub ) ); JOptionPane.showMessageDialog(this, "Add Subject already", "Message", JOptionPane.INFORMATION_MESSAGE); clearTextField(); } else if (event.getSource() == editBtn) { String s = codeText.getText(); int n = searchSubject( sub, s); if (n >= 0 ) { sub[n].setSubjectName(nameText.getText()); sub[n].setSubjectCredit( Integer.parseInt( creditText.getText() ) ); subTextArea.setText( readString(sub) ); JOptionPane.showMessageDialog(this, "Edit Subject already", "Message", JOptionPane.INFORMATION_MESSAGE); clearTextField(); } else { JOptionPane.showMessageDialog(this, "can not found subject code", "Error Message", JOptionPane.ERROR_MESSAGE); 662305 Information Technology Laboratory II- Chapter 9 หน ้า 11 จาก 13
12.
}
} else if (event.getSource() == deleteBtn) { String s = codeText.getText(); int n = searchSubject(sub, s); if (n >= 0 ) { nameText.setText( sub[n].getSubjectName() ); creditText.setText( sub[n].getSubjectCredit() + "" ); int ans = JOptionPane.showConfirmDialog(this, "Delete subject ", "Confirm", JOptionPane.YES_NO_OPTION); // 0 - Yes, 1 - No if (ans == 0) { sub[n] = null; System.gc(); subTextArea.setText( readString(sub) ); } clearTextField(); } else { JOptionPane.showMessageDialog(this, "can not found subject code", "Error Message", JOptionPane.ERROR_MESSAGE); } } else if (event.getSource() == showBtn) { String s = codeText.getText(); int n = searchSubject(sub, s); if (n >= 0 ) { nameText.setText( sub[n].getSubjectName() ); creditText.setText( sub[n].getSubjectCredit() + "" ); } else { JOptionPane.showMessageDialog(this, "can not found subject code", "Error Message", JOptionPane.ERROR_MESSAGE); } } else if (event.getSource() == clearBtn) { clearTextField(); } statusText.setText("Number Object : "+ SubjectNew.getCount()); } public int CheckArrayEmpty() { for(int n = 0 ; n < sub.length ; n++) if (sub[n] == null) return( n ); return( -1 ); } public void clearTextField() { codeText.setText(""); nameText.setText(""); creditText.setText(""); } 662305 Information Technology Laboratory II- Chapter 9 หน ้า 12 จาก 13
13.
public int searchSubject(SubjectNew
sub[], String s) { for(int n= 0 ; n < sub.length ; n++) { if ( sub[n] != null ) if ( s.equals(sub[n].getSubjectCode()) ) return(n); } return(-1); } public String readString(SubjectNew sub[]) { String str=""; for(int n = 0 ; n < sub.length ; n++) { if (sub[n] != null) str += sub[n].toString() + "n"; } return(str); } public void init( ) { Lab9_2 lab9_2 = new Lab9_2(15); } } ผลลัพธ์ 662305 Information Technology Laboratory II- Chapter 9 หน ้า 13 จาก 13
Télécharger maintenant