CS217 Object-Oriented Programming Assignment
CS217 Object-Oriented Programming Assignment
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 .