0% found this document useful (0 votes)
17 views

Assignment04 Opt1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Assignment04 Opt1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Java Basics

T ra in in g As s ig n men t

Document Code 25e-BM/HR/HDCV/FSOFT

Version 1.1

Effective Date 20/05/2019

Hanoi, 05/2020
Training Assignments Java Basics (Automation Test) Issue/Revision: x/y

RECORD OF CHANGES

No Effective Date Change Description Reason Reviewer Approver

1 20/May/2020 Createw a new assignment Create new DieuNT1 VinhNV

25e-BM/HR/HDCV/FSOFT v1.1 Internal use 2/6


Training Assignments Java Basics (Automation Test) Issue/Revision: x/y

Contents
Java OOP(II) .......................................................................................................................................................4
Objective .........................................................................................................................................................4
Business needs ..............................................................................................................................................4
Working requirements ....................................................................................................................................4
Product architecture .......................................................................................................................................4
Technologies ..................................................................................................................................................4
Stored Data ....................................................................................................................................................4
Exercise 1: ......................................................................................................................................................5
Exercise 2: ......................................................................................................................................................5
Exercise 3: ......................................................................................................................................................5
Exercise 4: ......................................................................................................................................................5

25e-BM/HR/HDCV/FSOFT v1.1 Internal use 3/6


Training Assignments Java Basics (Automation Test) Issue/Revision: x/y

CODE: Assignment01_Opt1
TYPE: Long
LOC: N/A
DURATION: 90 MINUTES

Java OOP(II)
Objective
- Java Inheritance, Java Method Overriding, Java super Keyword, Abstract Class & Method, Java
Interfaces, Java Polymorphism, Java Encapsulation

Business needs
- TBD

Working requirements
- Working environment: Eclipse IDE.
- Delivery: Source code, deployment and testing, reviewing evident packaged in a compress archive.

Product architecture
- N/A

Technologies
The product implements one or more technology:
- Java basics
- Java OOP (II)

Stored Data
- N/A

25e-BM/HR/HDCV/FSOFT v1.1 Internal use 4/6


Training Assignments Java Basics (Automation Test) Issue/Revision: x/y

Exercise 1:
Write a program to print the names of students by creating a Student class. If no name is passed while creating
an object of Student class, then the name should be "Unknown", otherwise the name should be equal to the
String value passed while creating object of Student class.

Exercise 2:
Create an abstract class 'Parent' with a method 'message'. It has two subclasses each having a method with
the same name 'message' that prints "This is first subclass" and "This is second subclass" respectively. Call
the methods 'message' by creating an object for each subclass.

Exercise 3:
Write a class that implements the CharSequence interface found in the java.lang package. Your
implementation should return the string backwards. Select one of the sentences from this book to use as the
data. Write a small main method to test your class; make sure to call all four methods.

Exercise 4:

Let's start with the Author class

A class called Author is designed as shown in the class diagram. It contains:

Three private member variables: name (String), email (String), and gender (char of either 'm' or 'f' - you might
also use a boolean variable called isMale having value of true or false).
A constructor to initialize the name, email and gender with the given values.
(There is no default constructor, as there is no default value for name, email and gender.)
Public getters/setters: getName(), getEmail(), setEmail(), and getGender().
(There are no setters for name and gender, as these properties are not designed to be changed.)
A toString() method that returns "name (gender) at email", e.g., "Tan Ah Teck (m) at
[email protected]".

25e-BM/HR/HDCV/FSOFT v1.1 Internal use 5/6


Training Assignments Java Basics (Automation Test) Issue/Revision: x/y

-- THE END --

25e-BM/HR/HDCV/FSOFT v1.1 Internal use 6/6

You might also like