Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Starting CODE(C++ code) #include #include #include #include using namespace std; //client_type class for storing all the relevant information of a client //client_type default constructor //client_type

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Starting CODE(C++ code)

#include #include #include #include

using namespace std;

//client_type class for storing all the relevant information of a client

//client_type default constructor

//client_type constructor that takes as input all the information of a client

//client_type accessor methods

//print member function that prints the information contained in the client_type object

//insurance_quote_type class for storing the estimate insurane quote for a specific client

//insurance_quote_type constructors

//estimate member fucntion of insurance_quote_type that uses the information of a client to estimate an insurance quote

//insurance_quote_type accessor method

int main() { //Create a queue of clients that need insurance quotes

//Calculate a quote for each client in the queue

return 0; }

/*

// OUTPUT CODE:

Client name: John Baddriver +City: Durban +Age: 37 +Gender: male +Marital status: Unmarried +Student: No +Prior coverage: No +Credit score: 4 +Driving record: 9 +Insurance Price: R 1150

You task is to develop an automated system that can handle queues of clients and estimate an insurance quote based on certain criteria, as your above research will show. An example program with clearly marked instructions of what needs to be completed has been provided. Page 1 of 5 DEVELOPMENT TASKS Develop a client_type class that can store all the personal and risk factor information of a specific client. It should be able to store the name of a client, the city in which the client lives, the age, gender and marital status. It should also have a flag that specifies if the client is a registered University student and if the client has previously had insurance coverage. The client_type class should also store the credit score, where 0 is a good credit rating and 10 is a bad credit rating. The last instance variable that should be included is the client's driving record that specifies how many incidents, accidents and insurance claims had the client been involved with. Note that all these instance variables should be private and that constructors and get/set accessor methods need to be developed to create, access and change the content of these variables. Some of the member functions and constructors that this class needs are: o A default constructor and a constructor that initialises the object using all the instance variables of the class. o You need to develop accessor methods for each of the instance variables of the class. This will allow the user of the class to retrieve and change the content of a specific instance variable. Some of the accessor methods have special conditions that need to be met before the instance variable can be changed. The city instance variable can only be changed if the new name of the city has 4 or more characters. Your insurance company only allows individuals between (and including) the age of 16 and 70 to be insured. Thus, the age of the client can only be changed to be within this boundary. The set_gender accessor method should take as input the string "male" or "female and convert and store this in the gender instance variable as a 0 for a male and 1 for a female. O A print member function should print the information of a single client in the following form. Client name: Jimmy Jones +City: Johannesburg +Age : 22 +Gender: male +Marital status: Maried +Student: Yes +Prior coverage: Yes +Credit score: 4 +Driving record : 1 Develop an insurance_quote_type class that can calculate and estimate the monthly insurance premium of a client. This class only has one private instance variable which will store the estimated_price. Some of the member functions and constructors that this class needs are: O A default constructor and a constructor that calculates the insurance price using the developed estimate function. The constructor should take as input a client type object that will be used to estimate the insurance quote. o The get_estimated_price accessor functions that can be used to access the previously stored estimated price that was stored in the class. Page 2 of 5 o The member function called estimate. This function should take as input the information of a single client and then use the client's information to estimate an insurance quote that is stored in the instance variable estimated_price. There are a number of rules and policies that are used to estimate the price, here is a list of rules that are used to determine how much a specific client should pay: The base insurance price is R250, everyone starts with this amount and then penalties and benefits are included. Credit score penalties: No penalties should be added if the client has an exceptional credit score of . R25 penalty should be added for each credit score rating more than 0. Thus, as an example, R25 will be added for a credit score of 1, R50 will be added for a credit score of 2 and R150 will be added for a credit score of 6. Age related penalties: People that are 25 years old and younger are more prone to accidents and are penalised by 'n R100. There are some exceptions. If the client has turned 21 or is older and has had a perfect driving record (no accident or claims), then he will only receive a half penalty of R50. If the client is a registered student, the client is considered to have a lower insurance risk and the client will receive a 20% reduction on the determined age related penalty. Location based penalties: If the client lives in one of the 6 most dangerous cities in South Africa then it is more likely that his vehicle will be stolen and he will receive a R250 penalty. Do an internet search for the most dangerous cities in the world and you will discover that 6 SA cities make the list of the top 20 most dangerous cities in the world; what do you think of this and what would you do in the code to account for this? Driving record penalties: If the client has only had one accident, then he is still low risk and he will receive a R50 penalty If a client has had 2 accidents, then is higher risk and will receive R100 penalty 3 Accidents will result in a high risk and the client will receive R300 penalty. 4 or more accidents will result in R400 penalty. Marital status benefit: Married clients tend to drive more save as they drive with loved ones and they don't want to put their family members at risk. Your insurance company wants to benefit married clients by giving them a 25% discount on the estimated price after the previous penalties have been added. Gender benefit: Male clients on average spend double the amount of time behind the wheel of a car compared to women clients and thus are more at risk of being in accidents. Woman drivers will not be penalized based on gender. Male driver will receive a 10% penalty on the estimated price after the previous penalties and benefits have been added. Prior coverage penalty: Clients that have not had previous insurance coverage will need to pay R50 more. Finally, develop the main program: o Develop a queue of clients for each of the clients shown in the given client information and example output provided below. Use a while loop to calculate and display the insurance quote for each of the clients in the queue. // OUTPUT CODE: Client name: John Baddriver +City: Durban +Age: 37 +Gender: male +Marital status: Unmarried +Student: No +Prior coverage: No +Credit score: 4 +Driving record: 9 +Insurance Price: R 1150 You task is to develop an automated system that can handle queues of clients and estimate an insurance quote based on certain criteria, as your above research will show. An example program with clearly marked instructions of what needs to be completed has been provided. Page 1 of 5 DEVELOPMENT TASKS Develop a client_type class that can store all the personal and risk factor information of a specific client. It should be able to store the name of a client, the city in which the client lives, the age, gender and marital status. It should also have a flag that specifies if the client is a registered University student and if the client has previously had insurance coverage. The client_type class should also store the credit score, where 0 is a good credit rating and 10 is a bad credit rating. The last instance variable that should be included is the client's driving record that specifies how many incidents, accidents and insurance claims had the client been involved with. Note that all these instance variables should be private and that constructors and get/set accessor methods need to be developed to create, access and change the content of these variables. Some of the member functions and constructors that this class needs are: o A default constructor and a constructor that initialises the object using all the instance variables of the class. o You need to develop accessor methods for each of the instance variables of the class. This will allow the user of the class to retrieve and change the content of a specific instance variable. Some of the accessor methods have special conditions that need to be met before the instance variable can be changed. The city instance variable can only be changed if the new name of the city has 4 or more characters. Your insurance company only allows individuals between (and including) the age of 16 and 70 to be insured. Thus, the age of the client can only be changed to be within this boundary. The set_gender accessor method should take as input the string "male" or "female and convert and store this in the gender instance variable as a 0 for a male and 1 for a female. O A print member function should print the information of a single client in the following form. Client name: Jimmy Jones +City: Johannesburg +Age : 22 +Gender: male +Marital status: Maried +Student: Yes +Prior coverage: Yes +Credit score: 4 +Driving record : 1 Develop an insurance_quote_type class that can calculate and estimate the monthly insurance premium of a client. This class only has one private instance variable which will store the estimated_price. Some of the member functions and constructors that this class needs are: O A default constructor and a constructor that calculates the insurance price using the developed estimate function. The constructor should take as input a client type object that will be used to estimate the insurance quote. o The get_estimated_price accessor functions that can be used to access the previously stored estimated price that was stored in the class. Page 2 of 5 o The member function called estimate. This function should take as input the information of a single client and then use the client's information to estimate an insurance quote that is stored in the instance variable estimated_price. There are a number of rules and policies that are used to estimate the price, here is a list of rules that are used to determine how much a specific client should pay: The base insurance price is R250, everyone starts with this amount and then penalties and benefits are included. Credit score penalties: No penalties should be added if the client has an exceptional credit score of . R25 penalty should be added for each credit score rating more than 0. Thus, as an example, R25 will be added for a credit score of 1, R50 will be added for a credit score of 2 and R150 will be added for a credit score of 6. Age related penalties: People that are 25 years old and younger are more prone to accidents and are penalised by 'n R100. There are some exceptions. If the client has turned 21 or is older and has had a perfect driving record (no accident or claims), then he will only receive a half penalty of R50. If the client is a registered student, the client is considered to have a lower insurance risk and the client will receive a 20% reduction on the determined age related penalty. Location based penalties: If the client lives in one of the 6 most dangerous cities in South Africa then it is more likely that his vehicle will be stolen and he will receive a R250 penalty. Do an internet search for the most dangerous cities in the world and you will discover that 6 SA cities make the list of the top 20 most dangerous cities in the world; what do you think of this and what would you do in the code to account for this? Driving record penalties: If the client has only had one accident, then he is still low risk and he will receive a R50 penalty If a client has had 2 accidents, then is higher risk and will receive R100 penalty 3 Accidents will result in a high risk and the client will receive R300 penalty. 4 or more accidents will result in R400 penalty. Marital status benefit: Married clients tend to drive more save as they drive with loved ones and they don't want to put their family members at risk. Your insurance company wants to benefit married clients by giving them a 25% discount on the estimated price after the previous penalties have been added. Gender benefit: Male clients on average spend double the amount of time behind the wheel of a car compared to women clients and thus are more at risk of being in accidents. Woman drivers will not be penalized based on gender. Male driver will receive a 10% penalty on the estimated price after the previous penalties and benefits have been added. Prior coverage penalty: Clients that have not had previous insurance coverage will need to pay R50 more. Finally, develop the main program: o Develop a queue of clients for each of the clients shown in the given client information and example output provided below. Use a while loop to calculate and display the insurance quote for each of the clients in the queue. // OUTPUT CODE: Client name: John Baddriver +City: Durban +Age: 37 +Gender: male +Marital status: Unmarried +Student: No +Prior coverage: No +Credit score: 4 +Driving record: 9 +Insurance Price: R 1150

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago