0% found this document useful (0 votes)
107 views121 pages

(3 Marks) You Have Main Function Which Is Saved On Folder Named Q1 Already. Use These

The document provides instructions for coding classes to solve multiple programming questions. For question 1, the student is asked to design classes called Person and Worker, where Worker inherits from Person. Worker needs a method to calculate income based on hours, pay rate, and tax brackets. For question 2, classes Student and MyStudent need to be coded to sort an array of students by name and count students by major. Question 3 involves coding a Flight class with methods to return route details. The main functions will test the coded classes.
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)
107 views121 pages

(3 Marks) You Have Main Function Which Is Saved On Folder Named Q1 Already. Use These

The document provides instructions for coding classes to solve multiple programming questions. For question 1, the student is asked to design classes called Person and Worker, where Worker inherits from Person. Worker needs a method to calculate income based on hours, pay rate, and tax brackets. For question 2, classes Student and MyStudent need to be coded to sort an array of students by name and count students by major. Question 3 involves coding a Flight class with methods to return route details. The main functions will test the coded classes.
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/ 121

1 of 4 Paper No: 1

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 1

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 1

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 1

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 2

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 2

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 2

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 2

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 3

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 3

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 3

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 3

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 4

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 4

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 4

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 4

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 5

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 5

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 5

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 5

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 6

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 6

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 6

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 6

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 7

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 7

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 7

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 7

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 8

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 8

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 8

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 8

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 9

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 9

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 9

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 9

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 10

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 10

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 10

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 10

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 11

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 11

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 11

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 11

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 12

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 12

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 12

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 12

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 13

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 13

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 13

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 13

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 14

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 14

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 14

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 14

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 15

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 15

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 15

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 15

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 16

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 16

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 16

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 16

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 17

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 17

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 17

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 17

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 18

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 18

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 18

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 18

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 19

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 19

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 19

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 19

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 20

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 20

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 20

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 20

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 21

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 21

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 21

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 21

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 22

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 22

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 22

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 22

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 23

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 23

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 23

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 23

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 24

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 24

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 24

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 24

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 25

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 25

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 25

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 25

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 26

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 26

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 26

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 26

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 27

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 27

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 27

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 27

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 28

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 28

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 28

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 28

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 29

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 29

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 29

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 29

The program output might look something like:

No of test Correct output


case
2

1
1 of 4 Paper No: 30

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about
a Worker. Information of a Worker includes:
 A double-value holding working hours of a Worker.
 A double-value holding the payment rate for a Worker.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o double getIncome() – use to determine salary of a person income = salary+
income tax, where salary = payment rate * working hours and
 income tax = 10 percent out of salary if salary > 5000
 otherwise incometax = 5 percent out of salary

The program output might look something like:

No Correct output Correct output


of
test
case
2 of 4 Paper No: 30

Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these
classes and function to test all your operations in this question, DO NOT EDIT ANY CODE in
main. You can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IStudent which will declare some operations for an Student – DO NOT EDIT this
one.
2. You only need to complete the code in class MyStudent and Student.
Design and code a class named Student that holds information about an Student. Information of a
Student includes:
 A string describing name of a Student.
 A string describing major of a Student

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class so that the main function can be run. Complete the
method
o public String getName() – return the name of a Student

Design and code a class named MyStudent which will implement interface IStudent and
complete 2 methods which were declared in IStudent (assume that number of Students in
list “s” is always greater than 2).
 List<Student> f1(List<Student> s) –. Firstly, sort the list of Student “s” ascending by student name
(alphabet order), finally return the list of 2 first students in the list “s”. The sorting must ignores
the case during comparison.
 int f2(ArrayList<Student> s) – count and return the number of students in the list “s” who are in
major of “SE”.
3 of 4 Paper No: 30

The program output might look something like:

Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these
classes and functions to test all your operations in this question, DO NOT EDIT ANY CODE in
main function. You can add more operations/classes/interfaces to be able to answer the below
question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:

 Constructors to set values for instance variables.


 Add needed operations to the class and complete below method which is declared in
Flight class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.
4 of 4 Paper No: 30

The program output might look something like:

No of test Correct output


case
2

1
For Examination Department Only

*********************************************************

Number of Paper:30

Generated at: 10/9/2017 10:19:19 PM

*********************************************************

You might also like