Question
Demonstrate the ability to: Learn the basic principles and theory of structured programming in C++ by implementing the classes: Patient Account Learn how to use
Demonstrate the ability to:
- Learn the basic principles and theory of structured programming in C++ by implementing the classes: Patient Account
- Learn how to use these principles and theory to help build and manipulate instances of the class (objects), call member functions
Reference
Chapter 10 – Classes and Data Abstraction
Grading:
Be sure to follow the Coding Standard Guidelines. You must properly indent and comment your code. This program is worth 100 points.
Grading rubric:
- Indent code and insert comments to document your program. [10 pts]
- Program must be implemented and run as instructed. [90 pts]
To receive the maximum of 80 points, this program must separate the
PatientAccount class implementation from the main function file and, in addition, the PatientAccount class must have its interface(PatientAccount.h) in a separate file from its implementation (PatientAccount.cpp).
The code in the following files:
- patientAccount.cpp
- accountDriver.cpp
- patientAccount.h
- Please use these file names exactly.
Summary
The lab requires you to create two files patientAccount.cpp and accountDriver.cpp. You will end up with patientAccount.h, patientAccount.cpp and accountDriver.cpp. (50%)
PatientAccount Class Definition:
Class Account | |
Private Data Members: static int genId int patientID double balance int daysInHospital SurgeryType surType string name int age char gender | Static data member used to assign value to patientID; Account ID Current Balance of the patientAccount Number of days in hospital Type of surgery Name of Patient Age of Patient Gender of Patient |
Public Member Functions: PatientAccount() PatientAccount(int p_id, double bal, in daysInHospital,SurgeryType surType, string name, int age, char gender) | Constructors: Default Constructor (no parameters) Overloaded Constructor: Three-Parameter Constructor |
Public Member Functions: void setPatientId (int x) void setBalance(double x) void setDaysInHospital(int x) void setSurType(SurgeryType x) void setName(string x) void setAge(int x) void setGender(char x) | Setters: (Make sure input is validated) Function sets patient id to x. Function sets patient balance to x . Function sets days in hospital to x Function sets surgery type to x Function sets patient name to x Function sets patient age to x Function sets patient gender to x |
Public Member Functions: int getPatientId () double getBalance() int getDaysInHospital() SurgeryType getSurType() string getName() int getAge() char getGender() | Getters: Function returns patient ID. Function returns patient account balance . Function returns days in hospital. Function returns surgery type. Function returns patient name. Function returns patient age Function returns patient gender |
Public Member Functions: | |
double calculateBalance() | Function calculates and returns the patient account balance. |
void reportSummary() | Function displays a summary of all the patientAccount information. |
Write a program that creates an array of 5 PatientAccount objects.
Main Program: (35%)
The program should ask the user to select an account number from 0 – 5 or -1 to exit the program.
After selecting an account number, the user should be presented with the following menu options:
- Enter 1 to select the type of surgery performed
- Choices are Liposuction, Nose Reshaping, Eyelid Surgery and Tummy Tuck
- Enter 2 Calculate and Display the patient account balance
- Enter 3 Display the Patient Summary Report
- Enter 99 to exit to the main menu to select another account number
When creating each PatientAccount object, make sure that each object is initialized in both the default and overloaded constructor functions with the following guidelines:
- Use the static data member to initialize the patientID. Patient ID must be initialized with multiples of 100 starting with 100. (5%)
- The starting balance of each PatientAccount object should be created from a random number generator function returning values between 100.00 and 2000.00. (5%)
- Use: enum SurgeryType {LIPOSUCTION,NOSE_RESHAPING,EYELID_SURGERY,TUMMY_TUCK}; (5%)
- The cost of surgery types is as follows:
- Liposuction = $2,500.00
- Nose Reshaping = $6,000.00
- Eyelid Surgery = $2,450.00
- Tummy Tuck = $12,900.00
Step by Step Solution
3.53 Rating (156 Votes )
There are 3 Steps involved in it
Step: 1
Note As no exact definition is provided for the calculateBalance function the function is defined to return the final balance after adding the cost of the surgery the patient opts for Screenshot of th...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started