SlideShare a Scribd company logo
Workshop 2
Q1. Write java program to manage fractions with addition, subtraction, multiplication and
division.
Q2. Vehicle Management System, including: car, motorbike, truck. Each of the Vehicle has
attributes of manufacturer, manufacture year, cost, color. Moreover, cars have types of engine,
number of seats. Motorbikes have power and trucks have load.
Code a class named Car, Motor, Truck are directly derived from base class Vehicle object.
Write a program with the following functions:
1. Input data of vehicles (validation data if necessarily)
2. To view the details of the vehicles (3 vehicles in one table or one for each table), to count
the number of vehicles in the following table.
3. Searching by manufacturer, manufacture year, cost, color, types of engine, seats, …
(exactly or approximately)
4. Searching from .. to…( manufacture year, cost)
5. Sorting by manufacturer, manufacture year, cost, color, types of engine, seats, …
6. To calculate statistics
Q3.
Library Management, including Book, Magazine, Newspaper. Each of the Document has
attributes of code, publisher and circulation (tổng số phát hành). Moreover, Books have author, title
and the number of pages. Magazines have issue number, monthly release. Newspapers have
Release date.
Code a class named Book, Magazine, Newspaper are directly derived from base class
Document object.
Write a program with the following functions:
1. Input data of documents (validation data if necessarily)
2. To view the details of all of documents (3 documents in one table or one for each table),
to count the number of documents in the following table.
3. Remove, update for a document (enter a code of document)
4. Searching by code, publisher, circulation, author, title and the number of pages … (exactly
or approximately)
5. Searching from .. to…( circulation, the number of pages, monthly release, Release date)
6. Sorting by code, publisher, circulation, author, title and the number of pages …
7. To calculate statistics
Q4.
One IT center requies full-time and part-time teachers. Full-time teacher information has teacher
code, full name, email, Professor (Học hàm) (non, Prof. (Professor), Assoc. Prof. (Asscociate
Professor), Assist. Prof. (Assistant Professor)), University degree (học vị) (Bachelor, Master,
Post Doctor), address, phone, number of teaching hours per month, basic pay (lương cơ bản), pay
rate (hệ số lương) (Bachelor: 1, Master: 1.1, Post Doctor: 1.2 and Prof. : +0.3, Assoc. Prof. +0.2,
Assist. Prof. +0.1), Norm hour (số giờ định mức), overtime hour (50.000 vnd/1h).
Part-time teacher information has teacher code, full name, email, Professor (non, Prof.
(Professor), Assoc. Prof. (Asscociate Professor), Assist. Prof. (Assistant Professor)), University
degree (Bachelor, Master, Post Doctor), address, phone, number of teaching hours per month,
pay rate (Bachelor: 1, Master: 1.1, Post Doctor: 1.2 and Prof. : +0.3, Assoc. Prof. +0.2, Assist.
Prof. +0.1), office, (200.000 vnd/1h).
Write a program with the following functions:
1. Enter the information for full-time and part-time teacher (validation data if necessarily)
2. Display all teacher information (in one table or one for each table), to count the number
of teachers in the following table.
3. Remove, update a teacher (enter code of teacher)
4. Searching by code, full name, email, Professor, Assoc. Prof., University degree, address,
phone, number of teaching hours per month, basic pay, pay rate … (exactly or
approximately)
5. Searching from .. to…( number of teaching hours per month, pay rate, …)
6. Sorting by code, full name, email, Professor, Assoc. Prof., University degree, address,
phone, number of teaching hours per month, basic pay, pay rate …
7. To calculate statistics
Q5. We have the design for Phone number:
PhoneNumber
- int area
- String number
+ PhoneNumber()
+ PhoneNumber(int a, String n);
+ void display();
IntPhoneNumber
- String countryCode
+ IntPhoneNumber ()
+IntPhoneNumber (String cc, int a, String n);
+ void display();
Implement the above classes and make your own main program to test all the above
methods. The output of your program something look like:
Enter list of phone numbers
-----------------------------------------
Type of phone number ? (1 – local phone, 2 – Inter phone number,
0 - exit): 1
Enter area code: 111
Enter number: 111111
Type of phone number ? (1 – local phone, 2 – Inter phone number,
0 - exit): 2
Enter country code: 22
Enter area code: 222
Enter number: 222222
Type of phone number ? (1 – local phone, 2 – Inter phone number,
0 - exit): 1
Enter area code: 333
Enter number: 333333
Type of phone number ? (1 – local phone, 2 – Inter phone number,
0 - exit): 2
Enter country code: 44
Enter area code: 444
Enter number: 444444
Type of phone number ? (1 – local phone, 2 – Inter phone number,
0 - exit): 0
List of phone number:
----------------------------------------
111 – 111111
22 – 222 – 222222
333 – 333333
44 - 444 – 444444
Note: You can using an array of base class PhoneNumber object
PhoneNumber phonelist[] = new PhoneNumber[1000]; or
ArrayList< PhoneNumber > phonelist = new ArrayList< PhoneNumber >();
Q6. We have the design for Staff:
Person
- String name
+ Person()
+ Person(String n)
+ void display();
+ double getSalary();
Officer
- double bSalary
+ Officer ()
+Officer (String n, double s)
+ void display();
+ double getSalary();
- Person. getSalary() is an abstract method
- Worker and Officer are subclasses of Person and Worker.salary = hrs * rate
Implement the above classes and make your own main program to test all the above methods
Add the below code to your main function and run
Q7. Create a class named DictionaryWord as:
DictionaryWord
- word: String
- meanings: String
+ DictionaryWord (String word, String meanings)
+ getWord(): String
+ setWord (String word): void
+ getMeanings(): String
+ setMeanings(String meanings): void
Write a program with the following requirements:
Creates 8 DictionaryWord objects with:
● Word and meanings as the table:
Word Meanings
bank robber Steals money from a bank
Burglar Breaks into a home to steal things
Worker
- double hrs
- final double RATE = 5.5
+ Worker()
+Worker(String n, double hrs)
+ void display();
+ double getSalary();
Forger Makes an illegal copy of something
Hacker Breaks into a computer system
Hijacker Takes control of an airplane
Kidnapper Holds someone for ransom money
Mugger Attacks and steals money from someone
Murderer Kills another person
● Ensure that there is no duplicate DictionaryWord objects (02 DictionaryWord objects a
and b are equal when a.word=b.word).
Displays all DictionaryWord in ascending order of word with the format as:
<<no>.<<word>>
<<meanings>>
<<no>.<<word>>
<<meanings>>
Where: <<no>>=1,2…
Hint:
● class DictionaryWord implements Comparable to order 2 DictionaryWord objects.
● override equals(..) method to compare 2 DictionaryWord objects.
● override toString()
● use Set to ensure no duplicate.
● use support class Collections to sort DictionaryWord objects.
Q8 :
1. Create a class Student includes name, age, mark and necessary methods. Using
FileWriter, FileReader and BufferedReader to write a program that has functional menu:
Menu
-------------------------------------------------
1. Add a list of Students and save to File
2. Loading list of Students from a File
3. Exit
Your choice: _
+ Save to File: input information of several students and write that information into a text file,
each student in a line (use tabs to separate the fields)
+ Read File: read and display information of students
Accept a file name from users and display the content of entered file. Display the error
message if that file does not exists.

More Related Content

What's hot (18)

PDF
DF1 - Py - Ovcharenko - Theano Tutorial
MoscowDataFest
 
PPTX
Two dimensional arrays
Neeru Mittal
 
PDF
Arrays and library functions
Swarup Kumar Boro
 
PDF
8th alg -l8.1
jdurst65
 
PDF
Arrays in C
Kamruddin Nur
 
PPTX
Arrays and Lists in C#, Java, Python and JavaScript
Svetlin Nakov
 
PPT
Thesis PPT
Drew Ferkin
 
PDF
Two dimensional array
Rajendran
 
PPT
Two dimensional array
Rajendran
 
DOCX
Paper no. 4
Rhea Mae Esmaña
 
PDF
Write a complete C++ program that does the following: 1. The program will c...
licservernoida
 
PDF
CP Handout#10
trupti1976
 
PDF
Array
hjasjhd
 
PPS
C programming session 04
Vivek Singh
 
PPTX
Whiteboarding Coding Challenges in Python
Andrew Ferlitsch
 
PPSX
C Programming : Arrays
Gagan Deep
 
DF1 - Py - Ovcharenko - Theano Tutorial
MoscowDataFest
 
Two dimensional arrays
Neeru Mittal
 
Arrays and library functions
Swarup Kumar Boro
 
8th alg -l8.1
jdurst65
 
Arrays in C
Kamruddin Nur
 
Arrays and Lists in C#, Java, Python and JavaScript
Svetlin Nakov
 
Thesis PPT
Drew Ferkin
 
Two dimensional array
Rajendran
 
Two dimensional array
Rajendran
 
Paper no. 4
Rhea Mae Esmaña
 
Write a complete C++ program that does the following: 1. The program will c...
licservernoida
 
CP Handout#10
trupti1976
 
Array
hjasjhd
 
C programming session 04
Vivek Singh
 
Whiteboarding Coding Challenges in Python
Andrew Ferlitsch
 
C Programming : Arrays
Gagan Deep
 

Similar to Exercise2 java (20)

PDF
Computer Practical
PLKFM
 
DOC
Sp 1418794917
lakshmi r
 
PDF
CS Sample Paper 1
kvs
 
PDF
Computer Science Sample Paper 2015
Poonam Chopra
 
PDF
90 Informatics Practices.pdf
vikas500500
 
PDF
Computer Science Sample Paper 2
kvs
 
PDF
computer science sample papers 2
Swarup Kumar Boro
 
PDF
EEE 3rd year oops cat 3 ans
Karthik Venkatachalam
 
PDF
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
Nithin Kumar,VVCE, Mysuru
 
PDF
Cs practical file
Shailendra Garg
 
PDF
Ch 4
AMIT JAIN
 
RTF
CBSE Grade12, Computer Science, Sample Question Paper
Malathi Senthil
 
DOCX
JAVA practical Exam Questions (1).docx
Lucky Ally
 
DOCX
Student DATABASE MANAGeMEnT SysTEm
home
 
PDF
Assignment Java Programming 2
Kaela Johnson
 
PDF
OOP Assignment 03.pdf
ARSLANMEHMOOD47
 
DOCX
OOP program questions with answers
Quratulain Naqvi
 
PDF
IP Sample paper 2 Class XI
Poonam Chopra
 
DOCX
Cs pritical file
Mitul Patel
 
PPT
Java cơ bản java co ban
ifis
 
Computer Practical
PLKFM
 
Sp 1418794917
lakshmi r
 
CS Sample Paper 1
kvs
 
Computer Science Sample Paper 2015
Poonam Chopra
 
90 Informatics Practices.pdf
vikas500500
 
Computer Science Sample Paper 2
kvs
 
computer science sample papers 2
Swarup Kumar Boro
 
EEE 3rd year oops cat 3 ans
Karthik Venkatachalam
 
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
Nithin Kumar,VVCE, Mysuru
 
Cs practical file
Shailendra Garg
 
Ch 4
AMIT JAIN
 
CBSE Grade12, Computer Science, Sample Question Paper
Malathi Senthil
 
JAVA practical Exam Questions (1).docx
Lucky Ally
 
Student DATABASE MANAGeMEnT SysTEm
home
 
Assignment Java Programming 2
Kaela Johnson
 
OOP Assignment 03.pdf
ARSLANMEHMOOD47
 
OOP program questions with answers
Quratulain Naqvi
 
IP Sample paper 2 Class XI
Poonam Chopra
 
Cs pritical file
Mitul Patel
 
Java cơ bản java co ban
ifis
 
Ad

More from NguynMinh294 (20)

PPTX
Slide An toàn mạng nâng cao PTIT
NguynMinh294
 
PDF
Phân tích thiết kế hệ thống thông tin PTIT
NguynMinh294
 
PDF
Bài giảng mật mã học cơ sở PTIT
NguynMinh294
 
PDF
Bài giảng an toàn ứng dụng web và csdl PTIT
NguynMinh294
 
PDF
Bài giảng an toàn ứng dụng web và csdl PTIT
NguynMinh294
 
PDF
Bài giảng kiểm thử xâm nhập PTIT
NguynMinh294
 
PDF
Bài giảng ký thuật theo dõi giám sát mạng PTIT
NguynMinh294
 
PDF
Giáo trình mạng máy tính PTIT
NguynMinh294
 
PDF
Ktvxl chuong 5 - cac phuong phap vao ra du lieu
NguynMinh294
 
PDF
Ktvxl chuong 4 - phoi ghep
NguynMinh294
 
PDF
Ktvxl chuong 3 - hop ngu 8088
NguynMinh294
 
PDF
Ktvxl chuong 2 - 8086-8088
NguynMinh294
 
PDF
Ktvxl chuong 1 - tong quan
NguynMinh294
 
PDF
bài giảng ký thuật vi xử lý PTIT
NguynMinh294
 
PDF
đề thi java ptit
NguynMinh294
 
PDF
Java exercises part 2
NguynMinh294
 
PDF
Java exercises part 1
NguynMinh294
 
PDF
Bai tap3 java
NguynMinh294
 
PDF
Bai tap2 java
NguynMinh294
 
PDF
Giáo trình hệ điều hành PTIT
NguynMinh294
 
Slide An toàn mạng nâng cao PTIT
NguynMinh294
 
Phân tích thiết kế hệ thống thông tin PTIT
NguynMinh294
 
Bài giảng mật mã học cơ sở PTIT
NguynMinh294
 
Bài giảng an toàn ứng dụng web và csdl PTIT
NguynMinh294
 
Bài giảng an toàn ứng dụng web và csdl PTIT
NguynMinh294
 
Bài giảng kiểm thử xâm nhập PTIT
NguynMinh294
 
Bài giảng ký thuật theo dõi giám sát mạng PTIT
NguynMinh294
 
Giáo trình mạng máy tính PTIT
NguynMinh294
 
Ktvxl chuong 5 - cac phuong phap vao ra du lieu
NguynMinh294
 
Ktvxl chuong 4 - phoi ghep
NguynMinh294
 
Ktvxl chuong 3 - hop ngu 8088
NguynMinh294
 
Ktvxl chuong 2 - 8086-8088
NguynMinh294
 
Ktvxl chuong 1 - tong quan
NguynMinh294
 
bài giảng ký thuật vi xử lý PTIT
NguynMinh294
 
đề thi java ptit
NguynMinh294
 
Java exercises part 2
NguynMinh294
 
Java exercises part 1
NguynMinh294
 
Bai tap3 java
NguynMinh294
 
Bai tap2 java
NguynMinh294
 
Giáo trình hệ điều hành PTIT
NguynMinh294
 
Ad

Recently uploaded (20)

PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PDF
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PDF
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 

Exercise2 java

  • 1. Workshop 2 Q1. Write java program to manage fractions with addition, subtraction, multiplication and division. Q2. Vehicle Management System, including: car, motorbike, truck. Each of the Vehicle has attributes of manufacturer, manufacture year, cost, color. Moreover, cars have types of engine, number of seats. Motorbikes have power and trucks have load. Code a class named Car, Motor, Truck are directly derived from base class Vehicle object. Write a program with the following functions: 1. Input data of vehicles (validation data if necessarily) 2. To view the details of the vehicles (3 vehicles in one table or one for each table), to count the number of vehicles in the following table. 3. Searching by manufacturer, manufacture year, cost, color, types of engine, seats, … (exactly or approximately) 4. Searching from .. to…( manufacture year, cost) 5. Sorting by manufacturer, manufacture year, cost, color, types of engine, seats, … 6. To calculate statistics Q3. Library Management, including Book, Magazine, Newspaper. Each of the Document has attributes of code, publisher and circulation (tổng số phát hành). Moreover, Books have author, title and the number of pages. Magazines have issue number, monthly release. Newspapers have Release date. Code a class named Book, Magazine, Newspaper are directly derived from base class Document object. Write a program with the following functions: 1. Input data of documents (validation data if necessarily) 2. To view the details of all of documents (3 documents in one table or one for each table), to count the number of documents in the following table. 3. Remove, update for a document (enter a code of document) 4. Searching by code, publisher, circulation, author, title and the number of pages … (exactly or approximately) 5. Searching from .. to…( circulation, the number of pages, monthly release, Release date) 6. Sorting by code, publisher, circulation, author, title and the number of pages … 7. To calculate statistics Q4.
  • 2. One IT center requies full-time and part-time teachers. Full-time teacher information has teacher code, full name, email, Professor (Học hàm) (non, Prof. (Professor), Assoc. Prof. (Asscociate Professor), Assist. Prof. (Assistant Professor)), University degree (học vị) (Bachelor, Master, Post Doctor), address, phone, number of teaching hours per month, basic pay (lương cơ bản), pay rate (hệ số lương) (Bachelor: 1, Master: 1.1, Post Doctor: 1.2 and Prof. : +0.3, Assoc. Prof. +0.2, Assist. Prof. +0.1), Norm hour (số giờ định mức), overtime hour (50.000 vnd/1h). Part-time teacher information has teacher code, full name, email, Professor (non, Prof. (Professor), Assoc. Prof. (Asscociate Professor), Assist. Prof. (Assistant Professor)), University degree (Bachelor, Master, Post Doctor), address, phone, number of teaching hours per month, pay rate (Bachelor: 1, Master: 1.1, Post Doctor: 1.2 and Prof. : +0.3, Assoc. Prof. +0.2, Assist. Prof. +0.1), office, (200.000 vnd/1h). Write a program with the following functions: 1. Enter the information for full-time and part-time teacher (validation data if necessarily) 2. Display all teacher information (in one table or one for each table), to count the number of teachers in the following table. 3. Remove, update a teacher (enter code of teacher) 4. Searching by code, full name, email, Professor, Assoc. Prof., University degree, address, phone, number of teaching hours per month, basic pay, pay rate … (exactly or approximately) 5. Searching from .. to…( number of teaching hours per month, pay rate, …) 6. Sorting by code, full name, email, Professor, Assoc. Prof., University degree, address, phone, number of teaching hours per month, basic pay, pay rate … 7. To calculate statistics Q5. We have the design for Phone number: PhoneNumber - int area - String number + PhoneNumber() + PhoneNumber(int a, String n); + void display(); IntPhoneNumber - String countryCode
  • 3. + IntPhoneNumber () +IntPhoneNumber (String cc, int a, String n); + void display(); Implement the above classes and make your own main program to test all the above methods. The output of your program something look like: Enter list of phone numbers ----------------------------------------- Type of phone number ? (1 – local phone, 2 – Inter phone number, 0 - exit): 1 Enter area code: 111 Enter number: 111111 Type of phone number ? (1 – local phone, 2 – Inter phone number, 0 - exit): 2 Enter country code: 22 Enter area code: 222 Enter number: 222222 Type of phone number ? (1 – local phone, 2 – Inter phone number, 0 - exit): 1 Enter area code: 333 Enter number: 333333 Type of phone number ? (1 – local phone, 2 – Inter phone number, 0 - exit): 2 Enter country code: 44 Enter area code: 444 Enter number: 444444 Type of phone number ? (1 – local phone, 2 – Inter phone number, 0 - exit): 0 List of phone number: ---------------------------------------- 111 – 111111 22 – 222 – 222222 333 – 333333 44 - 444 – 444444 Note: You can using an array of base class PhoneNumber object
  • 4. PhoneNumber phonelist[] = new PhoneNumber[1000]; or ArrayList< PhoneNumber > phonelist = new ArrayList< PhoneNumber >(); Q6. We have the design for Staff:
  • 5. Person - String name + Person() + Person(String n) + void display(); + double getSalary(); Officer - double bSalary + Officer () +Officer (String n, double s) + void display(); + double getSalary(); - Person. getSalary() is an abstract method - Worker and Officer are subclasses of Person and Worker.salary = hrs * rate Implement the above classes and make your own main program to test all the above methods Add the below code to your main function and run Q7. Create a class named DictionaryWord as: DictionaryWord - word: String - meanings: String + DictionaryWord (String word, String meanings) + getWord(): String + setWord (String word): void + getMeanings(): String + setMeanings(String meanings): void Write a program with the following requirements: Creates 8 DictionaryWord objects with: ● Word and meanings as the table: Word Meanings bank robber Steals money from a bank Burglar Breaks into a home to steal things Worker - double hrs - final double RATE = 5.5 + Worker() +Worker(String n, double hrs) + void display(); + double getSalary();
  • 6. Forger Makes an illegal copy of something Hacker Breaks into a computer system Hijacker Takes control of an airplane Kidnapper Holds someone for ransom money Mugger Attacks and steals money from someone Murderer Kills another person ● Ensure that there is no duplicate DictionaryWord objects (02 DictionaryWord objects a and b are equal when a.word=b.word). Displays all DictionaryWord in ascending order of word with the format as: <<no>.<<word>> <<meanings>> <<no>.<<word>> <<meanings>> Where: <<no>>=1,2… Hint: ● class DictionaryWord implements Comparable to order 2 DictionaryWord objects. ● override equals(..) method to compare 2 DictionaryWord objects. ● override toString() ● use Set to ensure no duplicate. ● use support class Collections to sort DictionaryWord objects. Q8 : 1. Create a class Student includes name, age, mark and necessary methods. Using FileWriter, FileReader and BufferedReader to write a program that has functional menu: Menu ------------------------------------------------- 1. Add a list of Students and save to File 2. Loading list of Students from a File 3. Exit Your choice: _
  • 7. + Save to File: input information of several students and write that information into a text file, each student in a line (use tabs to separate the fields) + Read File: read and display information of students Accept a file name from users and display the content of entered file. Display the error message if that file does not exists.