1B Lab 5
1B Lab 5
Demonstration:
1. Create a Project in codeblocks IDE to Implement.
Task 1:
Create a SavingsAccount class. An object of this class has Account
Name (type: String), Account Holders Name (type: String), Address
(type: String multiline input), and Annual Interest rate (yearly
interest rate), currentBalance.
Account Name (type: String): Comprising two words. Each word has a
length of 4-10.
Account Holders Name (type: String): Comprise of two words. Each word
has a length of 4-10.
Address (type: String): Comprise of 5 words. Each word has a length
of 4-10.
Annual interest rate (yearly interest rate): 2~5 percent with 0.10
step.
Current Balance : 1000 tk ~ 50000 tk.
Task 2:
Let employee information system of an institution keeps the records
of every employee’s name, date of birth and their respective
salaries. Create a class called employee that will allow you to store
all these information regarding an employee.
Write getter and setter functions for all the member variables.
(getter function return the value and setter function assign the
value from the parameter to the member variables). Before setting any
value to the member variables you need to check for these
Name: The length has to be more than two. Otherwise assign the
default name John Doe
Date of Birth: Every employee has an age higher than 18. If an
invalid value is given, assign 1 January 2002.
Salaries: The salary has to be in between BDT 10000 to BDT 100000. If
an invalid value is given, assign BDT 10000.
Define setInfo() function which will take input from the keyboard and
call all the setter functions to set the necessary information of an
employee object.
Define a function named getInfo() which will display all the stored
information belonging to an employee object using the return value of
the getter function.
All the member variables for the employee class should be private.