1

The Drive‑Rite Insurance Company provides automobile insurance policies for drivers. Design a single class diagram showing...

Question

The Drive‑Rite Insurance Company provides automobile insurance policies for drivers. Design a single class diagram showing...

The Drive‑Rite Insurance Company provides automobile insurance policies for drivers. Design a single class diagram showing the class, the application program, the relationship between the two, and multiplicity. Insert the completed class diagram into a Word document. Then write the pseudocode as described below. Be sure to follow the CSI 117 Style Criteria (Links to an external site.)Links to an external site. for naming conventions, class diagrams, pseudocode, keywords, and operators.

a.      Create a PolicyHolder class that contains a policy number, customer age, and the number of accidents in which the driver has been involved in the last three years. Include the following:

i.       A default constructor that initializes each attribute to some reasonable default value for a non-existent policy holder.

ii.     Another constructor method that has a parameter for each data member, called the overloaded constructor. This constructor initializes each attribute to the value provided when an object of this type is instantiated. If the customer's age is not between 14 and 125 inclusive, then display an error message and set the age to 0.

iii.   Accessor and mutator methods for each attribute. For the age mutator, if the customer's age is not between 14 and 125 inclusive, then set the age to 0, since this is obviously an error.

iv.   A method that displays all the data about a policy holder.

b.     An application program that contains two modules: the main() module and the checkAccident() module.

Include instructions in the main() module to do the following:

i.       Create and initialize a PolicyHolder object using the default constructor, naming it newPolicyHolder. Call the appropriate methods to initialize all the data members for the newPolicyHolder object, choosing appropriate values.

ii.     Create and initialize 2 different PolicyHolder objects using the overloaded constructor. Choose appropriate values for the attributes for each of the two PolicyHolder objects.

iii.   Call the checkAccident() method for each PolicyHolder object, so there will be 3 calls to the checkAccident() method.

The checkAccident() module must do the following:

i.       Accept a PolicyHolder argument (i.e., it has a parameter declared using PolicyHolder as the data type).

ii.     Display all the data for any policy holder that is over 35 years old and has one accident or less.

Answers

//Test java program
//PolicyHolderDriver.java
public class PolicyHolderDriver
{
   public static void main(String[] args)
   {
      
       //Create a default constructor
       PolicyHolder newPolicyHolder=new PolicyHolder();
       //set values for newpolicyholder object
       newPolicyHolder.setPolicyNumber("Premium-777");
       newPolicyHolder.setAge(38);
       newPolicyHolder.setAccidentCount(3);
      
      
       //create two more Policyholder objects with parameter values
       PolicyHolder pholder1=new PolicyHolder("Lack-1", 33, 1);
       PolicyHolder pholder2=new PolicyHolder("Lack-11", 36, 2);
      
       //calling checkAccident method for 3 objects
       checkAccident(newPolicyHolder);
       checkAccident(pholder1);      
       checkAccident(pholder2);
   }

   /**
   * Method that takes policyholder and check if age
   * is above 35 then print details of policy holder.
   * */
   private static void checkAccident(PolicyHolder holder) {      
       if(holder.getAge()>35)
       {
           System.out.println("Details of policy holder");
           System.out.println("Policy Holder whose age >35");
           holder.display();
       }
   }//end ofmethod  
}//end of class

--------------------------------------------------------------------------------------------

//PolicyHolder.java
public class PolicyHolder
{
   private String policyNumber;
   private int age;
   private int numaccidents;
  
   //default constructor
   public PolicyHolder()
   {
       //default values
       policyNumber="####";
       age=0;
       numaccidents=0;
   }
  
   //Parameter constructor
   public PolicyHolder(String policyNumber,
           int age, int numaccidents) {
       this.policyNumber=policyNumber;
       if(age<14 || age >125)
           age=0;
       else
           this.age=age;
       this.numaccidents=numaccidents;
   }
   //Setter method for policy number
   public void setPolicyNumber(String policyNumber)
   {
       this.policyNumber=policyNumber;
   }
   //Getter method policy number
   public String getPolicyNumber()
   {
       return policyNumber;
   }
   //Setter method for age
   public void setAge(int age)
   {
       if(age<14 || age >125)
           age=0;
       else
           this.age=age;
   }
  
   //Getter method for age
   public int getAge()
   {
       return age;
   }
   //Setter method for number of accidents
   public void setAccidentCount(int numaccidents)
   {
       this.numaccidents=numaccidents;
   }
  
   //Getter method for number of accidents
   public int getAccidentCount()
   {
       return numaccidents;
   }
   //Display object values
   public void display() {      
       System.out.printf("Policy Number : %s\n",policyNumber);
       System.out.printf("Age : %s\n",age);
       System.out.printf("# of Accidents : %s\n",numaccidents);
   }
  
  
}

--------------------------------------------------------------------------------------------

Sample Output screenshot:

Class Diagram for PolicyHolder


Similar Solved Questions

1 answers
James Kirk is a financial executive with Kingbird Enterprises. Although James Kirk has not had any...
James Kirk is a financial executive with Kingbird Enterprises. Although James Kirk has not had any formal training in finance or accounting, he has a “good sense” for numbers and has helped the company grow from a very small company ($534,000 sales) to a large operation ($48,060,000 in s...
1 answers
For the beam shown, draw the reactions at supports A and B in the positive direction,...
For the beam shown, draw the reactions at supports A and B in the positive direction, and also draw the shear and bending moment in the positive direction on your FBD. Calculate w lb/ft PID Mb.ft с Lft B a ft bft COLLAPSE IMAGES w = 140 lb/ft P= 200 lb L = 7 ft a = 4 ft b = 4 ft M = 80 lb.ft T...
1 answers
Gio's Restaurants is considering a project with the following expected cash​ flows: (Discounted payback period) Gio's...
Gio's Restaurants is considering a project with the following expected cash​ flows: (Discounted payback period) Gio's Restaurants is considering a project with the following expected cash flows: Year Project Cash Flow (millions) $(240) 0 1 92 65 3 92 4 90 If the project's appropri...
1 answers
GAME THEORYJust to be clear, 8,8,8 is incorrect. Many people have been posting that as the...
GAME THEORYJust to be clear, 8,8,8 is incorrect. Many people have been posting that as the answer. Player IlI Player II Player l A 1,1.1 444 B 7,5,7 -1,6,3 A 3,3,0 3,1,7 B 1,1,8 3,1,4 Player Player Consider the stage game above and suppose it is repeated twice without discounting. Consider all possi...
1 answers
#HNO_2# is the formula for which compound?
#HNO_2# is the formula for which compound?...
1 answers
People seek to form partnership to extend and maintain business operations. Each partner contributes to all...
People seek to form partnership to extend and maintain business operations. Each partner contributes to all aspects of the business including, money, property, labor or skill. The profits and losses of the business are shared among the partners. The decision-making process is important as each partn...
1 answers
How do you translate the word phrase into a variable expression: 3 increased by a number?
How do you translate the word phrase into a variable expression: 3 increased by a number?...
1 answers
Problem 1: The speed of shallow water waves in the ocean (e. g. seismic sea waves...
Problem 1: The speed of shallow water waves in the ocean (e. g. seismic sea waves or tsunamis) depends only on the still water depth and the acceleration due to gravity. Derive an expression for wave speed....
1 answers
Liquidation 1 and 2 please P12-6A Liquidation 1, inventory sold for $600,000 5070 339. 79. Kendra...
liquidation 1 and 2 please P12-6A Liquidation 1, inventory sold for $600,000 5070 339. 79. Kendra Cogley Mei Cash Inventory A/P Capital Beginning $ 180,800 $ 537,200 $ 245,500 $ 93,000 $ 212,500 $ 167,000 balances Sale of inventory Gain/Loss allocation Capital deficit(s) Payment of liabilities at BV...
1 answers
What are reasons to conduct a health assessment? Select all that apply. A. To generate data...
What are reasons to conduct a health assessment? Select all that apply. A. To generate data for grants and other sources of funding B. A comprehensive assessment is needed to meet accreditation requirements C. A health or environmental crisis has developed D. A topic is frequently brought up by memb...
1 answers
Part A (9pts) 1) Name at least four factors that influence a host's susceptibility to infectious...
Part A (9pts) 1) Name at least four factors that influence a host's susceptibility to infectious disease: Communicable diseases can spread through direct transmission and indirect transmission. Label the following six modes of transmission as either direct or indirect: (1pt) 2) Insect bite 3) Ha...
1 answers
Resistance (R) formula using Ohm's law is a. R=V/1 Ob.R=IN c. R=VI d. None
Resistance (R) formula using Ohm's law is a. R=V/1 Ob.R=IN c. R=VI d. None...
1 answers
A-D pleasees 02:44:25 Submit Quiz Quiz: Final Exam Time This Quiz: 50 pts possible 14 of...
A-D pleasees 02:44:25 Submit Quiz Quiz: Final Exam Time This Quiz: 50 pts possible 14 of 21 (17 complete) This Question: 3 pts The data set below contains spending on products (S) during a three-month period by a sample of 15 customers receiving incentives through a mobile loyaity Complete parts...
1 answers
Your birthday is next week and instead of other presents, your parents promised to give you...
Your birthday is next week and instead of other presents, your parents promised to give you $1,900 in cash. Since you have a part-time job and, thus, don't need the cash immediately, you decide to invest the money in a bank CD that pays 7.40 percent, compounded quarterly, for the next two years....
1 answers
Preble Company manufactures one product. Its variable manufacturing overhead is applied to production based on direct...
Preble Company manufactures one product. Its variable manufacturing overhead is applied to production based on direct labor-hours and its standard cost card per unit is as follows Direct material: 4 pounds at $9.00 per pound $36.00 Direct labor: 3 hours at $12 per hour Variable overhead: 3 hours at ...
1 answers
From the movie Invictus 1. Examine Nelson Mandela’s leadership in relation to the leadership mate...
From the movie Invictus 1. Examine Nelson Mandela’s leadership in relation to the leadership material such as democratic leadership and transformational leadership 2. Compare Nelson Mandela’s approach to change management with one of the change theories 3. Based on Chapters 16 & 18 o...
1 answers
A sample of 40 students enroll in a program that claims to improve scores on the...
A sample of 40 students enroll in a program that claims to improve scores on the quantitative reasoning portion of the Graduate Record Examination (GRE). The participants take a mock GRE test before the program begins and again at the end to measure their improvement. The mean number of points impro...
1 answers
I have 4 questions dont know can anyone help me with any of it? ii) Consider the 11 letter word MATHEMATICS a) How many distinct words can be formed by rearranging its letters? b) How many 4 letter wo...
I have 4 questions dont know can anyone help me with any of it? ii) Consider the 11 letter word MATHEMATICS a) How many distinct words can be formed by rearranging its letters? b) How many 4 letter words can be formed using the letters in the word MATHEMATICS, using letters no more often than they a...
1 answers
Is tht true or false? if is false plz explain. thks TRUE / FALSE Carbohydrates are...
is tht true or false? if is false plz explain. thks TRUE / FALSE Carbohydrates are an efficient way to store energy because they do not require water to be stored in order to be metabolized....
1 answers
5. (16 points) the circuit of Figure below, determine R) and neDife( p-30 v. Identify transient...
5. (16 points) the circuit of Figure below, determine R) and neDife( p-30 v. Identify transient and steady-state portions of the response. 6 2 ,(r) Hr) b) For the circuit of Figure above of Q.7, determine i() and vu( t) if e( t)-30cos4t. Identify transient and steady-state portions of the response....

-- 0.009478--