Question: Testing code import java.util.GregorianCalendar; public class ClientTester { public static void main(String args[]) { // Create an individual client, open some policies and then make

 Testing code import java.util.GregorianCalendar; public class ClientTester { public static voidmain(String args[]) { // Create an individual client, open some policies and

Testing code

import java.util.GregorianCalendar; public class ClientTester { public static void main(String args[]) { // Create an individual client, open some policies and then make some claims IndividualClient ic = new IndividualClient("Bob B. Pins"); ic.openPolicyFor(100); ic.openPolicyFor(200, 0.10f); ic.openPolicyFor(300, new GregorianCalendar(2020, 0, 2, 23, 59).getTime()); ic.openPolicyFor(400, new GregorianCalendar(2009, 5, 4, 12, 00).getTime()); Policy p = new Policy(500); System.out.println("Here are the Individual Client's policies:"); for (int i=0; i

Expected output

Here are the Individual Client's policies:

Policy: 0001 amount: $100.00

DepreciatingPolicy: 0002 amount: $200.00 rate: 10.0%

ExpiringPolicy: 0003 amount: $300.00 expires: January 02, 2020 (11:59PM)

ExpiringPolicy: 0004 amount: $400.00 expired on: June 04, 2009 (12:00PM)

Making claims:

Claim for policy 0001: $100.00

Claim for policy 0002: $180.00

Claim for policy 0003: $300.00

Claim for policy 0004: $ 0.00

Claim for policy 0005: $ 0.00

Here are the Individual Client's policies after claims:

ExpiringPolicy: 0004 amount: $400.00 expired on: June 04, 2009 (12:00PM)

DepreciatingPolicy: 0002 amount: $180.00 rate: 10.0%

ExpiringPolicy: 0003 amount: $300.00 expires: January 02, 2020 (11:59PM)

The total policy coverage for this client: $880.00

Here are the Company Client's policies:

Policy: 0006 amount: $1000.00

DepreciatingPolicy: 0007 amount: $2000.00 rate: 10.0%

ExpiringPolicy: 0008 amount: $3000.00 expires: January 02, 2020 (11:59PM)

ExpiringPolicy: 0009 amount: $4000.00 expired on: June 04, 2009 (12:00PM)

Making claims:

Claim for policy 0006: $1000.00

Claim for policy 0007: $2000.00

Claim for policy 0008: $3000.00

Claim for policy 0009: $ 0.00

Claim for policy 0005: $ 0.00

Here are the Company Client's policies after claims:

Policy: 0006 amount: $1000.00

DepreciatingPolicy: 0007 amount: $1800.00 rate: 10.0%

ExpiringPolicy: 0008 amount: $3000.00 expires: January 02, 2020 (11:59PM)

ExpiringPolicy: 0009 amount: $4000.00 expired on: June 04, 2009 (12:00PM)

The total policy coverage for this client: $9800.00

Cancelling policy #12 ... did it work: false

Cancelling policy #8 ... did it work: true

The total policy coverage for this client: $6800.00

(2) The Clients We will now define the following hierarchy To begin, copy the code from the following Client class: import java.util. public abstract class Client Object Client IndividualClient CompanyClient private static final int MAX POLICIES PER CLIENT # 10; private static int NEXT CLIEN ID: private String private int protected Policy[) protected int name: id: policies numPolicies public Client (String n) t name n; id NEXT CLIENT ID4+ policies new policy [MAX POLICIES PER CLIENT); numPolicies 0; public String getName return name: public int getld return id: public Policyl getPolicies) return policies; publie int getNumPolicies) return numPolicies: public String toString) t return String.format ("Client : %06d amount: %s", id, name); Create the following in the Client class: . a public method called totalCoverage) which returns a float containing the total amount of coverage of all the client's policies a public method called addPolicy(Policy p) which adds the given Policy to the array of policies, provided that the limit has not been reached and returns the Policy object, or null if not added .a public method called openPolicyFor(float amt) which creates a new Policy for the amount specified in the parameter and adds it to the client using (and returning the result from) the addPolicy() method

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!