J a va B asi c s
Training Assignments
Document Code 25e-BM/HR/HDCV/FSOFT Version 1.1
Effective Date 20/11/2012 Hanoi, 06/2019
Lab Guides Data Structure & Algorithm Issue/Revision: x/y RECORD OF CHANGES
No Effective Date Change Description Reason Reviewer Approver
1. 01/Oct/2018 Create new Draft DieuNT1 VinhNV
2. 01/Jun/2019 Fsoft Template Update DieuNT1 VinhNV
25e-BM/HR/HDCV/FSOFT v1.1 Internal use 2/5
Lab Guides Data Structure & Algorithm Issue/Revision: x/y
Contents
Day 2. Assignment 2: Flow Controls................................................................................................4
Objectives:...................................................................................................................................4
Assignment Specifications: ..........................................................................................................4
Business Rules:...........................................................................................................................4
Problem Descriptions:..................................................................................................................4
Guidelines:...................................................................................................................................5
25e-BM/HR/HDCV/FSOFT v1.1 Internal use 3/5
Lab Guides Data Structure & Algorithm Issue/Revision: x/y
CODE: JAVA.M.A201
TYPE: MEDIUM
LOC: 200
DURATION: 120 MINUTES
Day 2. Assignment 2: Flow Controls
Objectives:
» Understand basic concept about OOP.
» Working with control flows: if, for, do..while, while.
Assignment Specifications:
Create a class to represent a Course type in java, which should have following:
Instance variables:
» course code: course id, String type
» course name: course name, String type
» duration: course duration, double type
» status: status course, String type
» flag: mark the course is optional or required, String type
Constructor:
» No-argument constructor: set all attribute with a default value of 0.0 or null. »
Constructor: that accept 5 arguments for attributes.
Instance methods:
» Getter/setter methods.
» Overriding toString() method to print student detail.
» public void input():This method to enter values for Course from information from the keyboard. Create
a new class named CourseManagement with a main() method.
Business Rules:
» course code: is a string of 5 characters, started by “FW” and followed by 3 digits. »
status: only accept ‘active’ or ‘in-active’.
» flag: only accept ‘optional’, ‘mandatory’, ‘N/A’.
Problem Descriptions:
Requirement: write a java console program.
25e-BM/HR/HDCV/FSOFT v1.1 Internal use 4/5
Lab Guides Data Structure & Algorithm Issue/Revision: x/y
a. Create an array of 10 courses and input data from the keyboard. Invalid values require repeat re-input until
the correct value.
b. Search courses by one of the attributes (method named: find(String type, Object data). In which, the type:
attribute name, the data: data for search.
c. Display all courses that flag is “mandatory”.
Guidelines:
» Create a project named Java.M.A201, create package fa.training.entities that contains Course class,
fa.training.utils that contains Validator class for validation.
» Create a new package named fa.training.main contains CourseManagement class.
25e-BM/HR/HDCV/FSOFT v1.1 Internal use 5/5