0% found this document useful (0 votes)
13 views2 pages

CS217 Object-Oriented Programming Assignment

This document outlines the requirements for Assignment 4 in Object Oriented Programming (CS217), which includes creating classes for Book, Student, Employee, and a Chat application. Each class has specific attributes and methods that need to be implemented, such as managing records, calculating salaries, and handling messages. The assignment emphasizes the importance of individual work and has a deadline of 02/05/2021.

Uploaded by

bitame6994
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)
13 views2 pages

CS217 Object-Oriented Programming Assignment

This document outlines the requirements for Assignment 4 in Object Oriented Programming (CS217), which includes creating classes for Book, Student, Employee, and a Chat application. Each class has specific attributes and methods that need to be implemented, such as managing records, calculating salaries, and handling messages. The assignment emphasizes the importance of individual work and has a deadline of 02/05/2021.

Uploaded by

bitame6994
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

Object Oriented PROGRAMMING (CS217)

ASSIGNMENT-4

Instructions

You are free to consult each other for verbal help. However copying or sharing the code with
each other will not only result into the cancellation of the current assignment, it may
impact your grade in all the assignments and exams as well.

Note: You will use 3 file structure from now onwards.


Deadline: 02/05/2021

1. Create a class named ‘Book’ having following private member variable


Id (Randomly generate in constructor), Name, Author, Edition, DateofPublish.
All the books belong to a single library.
[Link] appropriate setter/getter for each of the above member variables.
[Link] appropriate constructors and destructor.
[Link] shallow/deep copy (better one) to sort the array of books according to their
publish date.
[Link] the details of most recently published 5 books.
[Link] allocate an array of objects.

2. It’s time to help your academic officer to automate their Registration Process. Create a
class student having all essential attributes to store the record of a student. The class
should maintain a record of total number of students enrolled.
[Link] registration no. of a student, once assigned, cannot be changed. (Assigned on
the time of registration(object creation))
[Link] student can register at most 5 and at least 3 courses.
[Link] courses can be dropped if that course has been registered for 5 days.
[Link] record (e.g. CNIC, Address etc.) can be updated.
[Link] program should be menu driven having following options
2.5.1. Register a Student
2.5.2. Register Courses
2.5.3. Drop Courses
2.5.4. Update Record
2.5.5. Delete a Student
2.5.6. Search a Student (Should return an object of Student Class)
2.5.7. Get a list of students (Studying a specific course together)
2.5.8. Total count of Students Enrolled
[Link] separate functions for each of the above operations.
3. Create a class Employee having private attributes id (constant), name, salaryPerHour,
monthlyWorkedHours, taxPaid, yearofJoining. Write a menu driven program to perform
following tasks, each task governed by a specific function.
[Link] Hours of an employee (Admin updates the hours of an employee by end of
the day).
[Link] Salary of an Employee
[Link] monthly Salary of an employee
3.3.1. 10% tax is deducted from the salary and is automatically added to the taxPaid.
3.3.2. 1000 is deducted from salary as health insurance fee.
3.3.3. A senior employee (working in the company for more than 8 years) gets 10%
additional bonus after deduction.
Note: Each operation should have its own function. E.g. isSeniorEmployee();
3.3.4. Generate a Receipt of the Salary.

4. Create a small chat application. Each user has unique id(constant), name, contactNo.
Each user can send/receive maximum 10 messages. Your Program should keep a record
of sent and received messages of each user. If message memory gets full(10), user need
to empty his message box to send/receive new messages.
Your Program should be able to perform following tasks, each govern by a function
[Link] a Message
[Link] Received Messages
[Link] Message Box
[Link] info ( Name, ContactNo)
[Link] Check (How much message box is empty)
Use setter/getter for each of the attribute.
If receiver’s message box is full, sender should get a warning that Recipient can’t receive
new messages due to memory shortage at the moment.

Good Luck ☺

The only thing that overcomes hard luck is hard work.


Harry Golden

Common questions

Powered by AI

The chat application allows sending messages, viewing received messages, emptying the message box, updating user info, and checking message box memory status. Memory is managed by allowing each user to store up to 10 messages; if this limit is reached, users must empty their message box before sending or receiving new messages. If a recipient's message box is full, the sender receives a warning .

The assignment instructions explicitly state that while verbal consultation is allowed, any copying or sharing of code will result in the cancellation of the current assignment and may negatively affect grades across all assignments and exams. This strict policy serves as a safeguard against code duplication and sharing .

A menu-driven interface is significant in these applications as it provides a structured and user-friendly way to navigate through the different functionalities. Each option in the menu corresponds to a specific function, which simplifies the interaction for the users and ensures that operations are performed systematically .

Using a deep copy is advantageous in this context as it involves copying all fields and the objects that are referenced, ensuring that each copy of the object has its own memory location. This avoids potential issues with shared references, which can lead to unintended side effects when sorting the array of books by publish date .

The program manages updates to records by providing dedicated functions that allow modifications to personal information such as CNIC, address for students, or work hours and salary for employees. These functions rely on setter methods to ensure updates are made consistently and correctly while maintaining data integrity .

The program provides separate functions to update an employee's work hours and change their salary. The functions ensure that these operations are executed correctly, maintaining employee records up to date by allowing administrative updates at the end of the day .

The program maintains a record of the total number of enrolled students by keeping a persistent count variable within the student class which is updated every time a new student is registered, ensuring the total count reflects the current enrollment accurately .

The monthly salary in the 'Employee' class is calculated by considering the salary per hour and total monthly worked hours. Deductions include a 10% tax and a 1000 unit health insurance fee. For senior employees, working for more than 8 years, an additional 10% bonus is applied after these deductions .

Students can register for a minimum of three and a maximum of five courses. Courses can be dropped only after being registered for at least five days. Each operation related to registration and modification, including registering a student, registering courses, dropping courses, updating records, deleting a student, searching for students, and retrieving a list of students studying a specific course, is handled by separate functions .

The program ensures that a student's registration number remains immutable by assigning it at the time of object creation and not providing any setter method to modify it afterward .

You might also like