0% found this document useful (0 votes)
8 views3 pages

1B Lab 5

The document outlines a programming assignment involving the creation of a SavingsAccount class and an Employee class in CodeBlocks IDE. It includes tasks such as implementing member functions for account management, generating random account information, and validating employee data. Additionally, it specifies requirements for testing the classes and handling user input for both account and employee information.

Uploaded by

teslanicola398
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)
8 views3 pages

1B Lab 5

The document outlines a programming assignment involving the creation of a SavingsAccount class and an Employee class in CodeBlocks IDE. It includes tasks such as implementing member functions for account management, generating random account information, and validating employee data. Additionally, it specifies requirements for testing the classes and handling user input for both account and employee information.

Uploaded by

teslanicola398
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/ 3

Week 5: String Class, Array of Objects,

Reference Variable, Use of Project feature


in CodeBlocks IDE.
Term Project Proposal Discussion

Learning Materials: Chapter 7

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.

Provide a public getter setter function for each member variable.

Provide deposit and withdrawal functions (public) with necessary


checking.

Provide a public member function double calculateInterest(int


periodInMonths) that calculates the interest based on the minimum
balance of that account (up to the last interest disbursed) and
return it. Ensure that this function will not change any member data.

Provide a public member function disburseInterest(int periodInMonths)


which will deposit the amount of interest and reset the minimum
balance.

Write a driver program to test the class SavingsAccount.

Create 100 SavingAcoount objects.

Write a function (non-member) void EditInformationByKeyboard() that


takes a SavingAccount object as parameter. This function will take
input from the keyboard and set the member variable. Now call this
function for the first 2 objects.
Write a function (non-member) void generateInformaiotnRandom() takes
a SavingAccount object as parameter. This function will assign the
value randomly from a range. Call this function for the remaining
objects.

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.

Write a function (non-member) void ShowInterestAll(SavingAccount


ar[]) that displays the interest amount of all accounts. Ask for the
confirmation to confirm disbursement.

Write a function (non-member) void


ShowAllAlphabetically(SavingAccount ar[]) that displays all the
account name and its current balance according to the alphabetical
order of account name.

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.

Convert all the suitable functions to const member functions.


Include one more const member function named Employee
compareAge(Employee e) which will return the elder employee object
based on the date of birth.

You might also like