Question: Lab 7 Object-Oriented Programming Objectives: After performing this lab, the students should be able to design classes that models real-world entities write class declarations that



Lab 7 Object-Oriented Programming Objectives: After performing this lab, the students should be able to design classes that models real-world entities write class declarations that contain member variables and methods with the appropriate visibility implement basic member functions, including getters and setters Activities Part A 1. Explain the relationship between a class and an object. 2. Provide at least two different reasons for using object-oriented programming. 1) 11) III) 3. Design a class that models the two main entities involved in the following scenario: You are a software developer at a major technology company. You are designing an OOP program that helps patients with dementia remember their daily activities and information about people. The program helps the user keep track of the time, description, and location of each daily activity. It also helps the user maintain a list of important contacts, including their names, contact information, and pictures. The program provides easy ways to retrieve, record, and update the information. It automatically provides reminders about activities based on the user's current location. It also provides information about people that the user encounters, where available, based on images captured in real-time (for example, the user could be wearing a wearable camera that automatically captures pictures of people with whom the user is interacting). What are two main entities that you would implement with a class? For each entity, determine the data members and member functions and record them in the following tables. Provide both the variable/function declarations as well as their descriptions. Page 1 of 3 Entity 1 Description Member Variables Description Member Methods Description Entity 2 Description Member Variables Description Member Methods Description Page 2 of 3 Part B Provide your C++ source code and screenshots of your program outputs. Write a class definition for a BankAccount class that contains the following members: Member variables o account ID (of the form XXXXX-XXXXX, where x is a digit) o account holder name (e.g. John Joe) account balance Member methods o Initialize(ID, name, balance): sets the account ID to a given ID, the account holder name to the given string, and account balance to a given number o SetHolderName(name): sets the account holder name to the given name o IncreaseBalance(amount): increases balance by the given amount o DecreaseBalance(amount): if the given amount is no more than the balance, remove it from the balance and return true; otherwise, return false o Deactivate: deactivates the account by setting the account ID to 00000-00000, holder name to the empty string, and balance to o IsActive: returns true if the account is active and false otherwise (an account is inactive if the account ID is 00000-00000 and the holder name is the empty string o Print: displays the state of the account (values of the member variables in an organized format) o GetID: gets the account ID o GetHolderName: gets the account holder name o GetBalance: gets the account balance Implement all class member functions. Part C: The drive" program In your main write a simple program that tests the BankAccount class. The program should create a BankAccount object and invoke each of its member methods. Display the states of the BankAccount object where appropriate. By observing expected outputs from the driver program, you should obtain assurance that your class is implemented correctly. Page 3 of 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
