Question: UML Sequence Diagrams You will examine Java source code for an insurance project and build a compliant UML sequence diagram to fully represent the private

 UML Sequence Diagrams You will examine Java source code for an

insurance project and build a compliant UML sequence diagram to fully representthe private static method createCarPolicyAndClaim() in the Driver class. Please make surethat you represent the loop correctly, when all claims are displayed inthe forEach() method. package insurance; public interface Accruable { public abstract voidaccrue(); } package insurance; public interface BorrowAgainst { public abstract double borrowAgainst(doubleamountRequested); } package insurance; import javax.swing.JFrame; import javax.swing.JoptionPane; public interface Displayable {public default void display() { JFrame frame = new JFrame("Florida National InsuranceCompany"); JOptionPane.showMessageDialog(frame, this.tostring()); } } package insurance; import java.time. LocalDate; public classDriver { public static void main(String[] args) { createCarPolicyAndclaim(); } private staticvoid createCarPolicyAndclaim() { // First make a customer Customer hugo = newCustomer(132991928L, "Hugo", "Weaving", "weaving@matrix.org", "6092281836"); // Then make and display a carpolicy for the customer CarPolicy p = new CarPolicy("FDW-192", 200000, hugo, 34219098721431L,"Toyota", "Camry", 2020, 23900, CarPolicy.CarInsuranceType.GAP); p.display(); // Create a claim and fileit against the policy Claim claim = new Claim("The", "Oracle", claim.ClaimType.FACTUAL, LocalDate.now(),750, "Red pill swalowing."); p.fileclaim(claim); // File an update to the claimp.fileclaim("F-1001", "the", "Oracle", claim.claimType. FACTUAL, LocalDate.now(), 750, "Blue pill swalowing."); // Displayall claims for the policy p.getclaims ().values().forEach(C -> c.display(); } } packageinsurance; public class LifePolicy extends Policy implements Accruable, BorrowAgainst { private double

UML Sequence Diagrams You will examine Java source code for an insurance project and build a compliant UML sequence diagram to fully represent the private static method createCarPolicyAndClaim() in the Driver class. Please make sure that you represent the loop correctly, when all claims are displayed in the forEach() method. package insurance; public interface Accruable { public abstract void accrue(); } package insurance; public interface BorrowAgainst { public abstract double borrowAgainst(double amountRequested); } package insurance; import javax.swing.JFrame; import javax.swing.JoptionPane; public interface Displayable { public default void display() { JFrame frame = new JFrame("Florida National Insurance Company"); JOptionPane.showMessageDialog(frame, this.tostring()); } } package insurance; import java.time. LocalDate; public class Driver { public static void main(String[] args) { createCarPolicyAndclaim(); } private static void createCarPolicyAndclaim() { // First make a customer Customer hugo = new Customer(132991928L, "Hugo", "Weaving", "weaving@matrix.org", "6092281836"); // Then make and display a car policy for the customer CarPolicy p = new CarPolicy("FDW-192", 200000, hugo, 34219098721431L, "Toyota", "Camry", 2020, 23900, CarPolicy.CarInsuranceType.GAP); p.display(); // Create a claim and file it against the policy Claim claim = new Claim("The", "Oracle", claim.ClaimType.FACTUAL, LocalDate.now(), 750, "Red pill swalowing."); p.fileclaim(claim); // File an update to the claim p.fileclaim("F-1001", "the", "Oracle", claim.claimType. FACTUAL, LocalDate.now(), 750, "Blue pill swalowing."); // Display all claims for the policy p.getclaims ().values().forEach(C -> c.display(); } } package insurance; public class LifePolicy extends Policy implements Accruable, BorrowAgainst { private double cashvalue; public LifePolicy (String policyNumber, double premium, Customer customer, double cashvalue) { super (policyNumber, premium, customer); this.cashvalue = cashValue; } @Override public double borrowAgainst(double amountRequested) { if (this.cashvalue > amountRequested) { return amountRequested; } else { return this.cashvalue; } } @Override public void accrue) { this.cashvalue += calculateAccrualAmount(); } private double calculateAccrualAmount() { int accrual Amount = 0; // TODO code the accrual algorithm return accrualAmount; } @Override public String tostring() { return "LifePolicy [cashvalue=" + cashvalue + ", customer=" + customer + "]"; } } package insurance; public interface Transferrable { public abstract boolean transfer(Customer newCustomer); } package insurance; import java.util.ArrayList; public class CarPolicy extends Policy implements Transferrable { public enum CarInsuranceType { LIABILITY, COLLISION, COMPREHENSIVE, GAP } private long vin; private String make; private String model; private int year; private int mileage; private CarInsuranceType type; public CarPolicy(String policyNumber, double premium, Customer customer, long vin, String make, String model, int year, int mileage, CarInsuranceType type) { super(policyNumber, premium, customer); this.vin = vin; this.make = make; this.model = model; this.year = year; this.mileage = mileage; this.type = type; } @override public boolean transfer(Customer newCustomer) { this.customer = newCustomer; return true; } public long getvin() { return vin; } public void setvin(long vin) { this.vin = vin; } public String getMake() { return make; } public void setMake(String make) { this.make = make; } public string getModel() { return model; } public void setModel(String model) { this.model = model; } public int getYear() { return year; } public void setyear(int year) { this.year = year; } public int getMileage() { return mileage; } public void setMileage(int mileage) { this.mileage = mileage; } public Car InsuranceType getType() { return type; } public void setType(CarInsuranceType type) { this.type = type; } @Override public String tostring() { return "CarPolicy (vin=" + vin + ", make=" + make + ", model=" + model + year=" + year + ", mileage=" + mileage + , type=" + type + ". customer=" + customer + "]"; } } package insurance; import java.time. LocalDate; import javax.swing. JFrame; import javax.swing. JoptionPane; public class claim implements Displayable { public enum ClaimType { DEFINITIONAL, FACTUAL, POLICY, VALUE } private String claimID; private String firstName; private String lastName; private claimType claimType; private LocalDate claimDate; private double amountsought; private String description; private static int lastclaimID = 1000; public claim(String firstName, string lastName, claimType claimType, LocalDate claimbate, double amountsought, string description) { this.claimID = claimType.name().charAt(0) + "-" + ++lastclaimID; this.firstName = firstName; this.lastName = lastName; this.claimType = claimType; this.claimDate = claimDate; this.amountsought = amount sought; this.description = description; } public String getclaimID() { return claimID; } public void setclaimID(String claimID) { this.claimID = claimID; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public string getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public claimType getclaimType() { return claimType; } public void setclaimType(ClaimType claimType) { this.claimType = claimType; } public LocalDate getclaimDate() { return claimDate; } public void setclaimDate(LocalDate claimDate) { this.claimDate = claimDate; } public double getAmount sought() { return amount sought; } public void setAmountsought(double amountsought) { this.amountsought = amountsought; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } 11 @Override public string tostring() { return "Claim [claimID=" + claimID + ", firstName=" + firstName + ", lastName=" + lastName + + claimType + ", claimDate=" + claimDate + ", amountsought=" + amountsought + + description + "]"; } claimType=" ", description" @Override public void display() { // change the default implementation JFrame frame = new JFrame("Florida National Insurance Company"); String claimInfo = "Claim #" + this.claimID + " " + this.description; JOptionPane.showMessageDialog(frame, claimInfo); } } package insurance; public class Customer { private long ssn; private String firstName; private String lastName; private String email; private string phone; public Customer(long ssn, string firstName, string lastName, string email, String phone) { this.ssn = ssn; this.firstName = firstName; this.lastName = lastName; this.email = email; this.phone = phone; } public long getssn() { return ssn; } public void setssn(long ssn) { this.ssn = ssn; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public string getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } @Override public String tostring() { return "Customer (ssn=" + ssn + ", firstName=" + firstName + ", lastName=" + lastName + ", + ", phone=" + phone + "]"; } email=" + email } package insurance; import java.time. LocalDate; import java.util.ArrayList; public class HomePolicy extends Policy implements Transferrable { public enum Coverage { CASH_VALUE, REPLACEMENT, ALL_RISK } String address; int zipcode; LocalDate constructionDate; LocalDate lastInspected; Coverage coverage; public HomePolicy(String policyNumber, double premium, Customer customer, string address, int zipcode, LocalDate constructionDate, LocalDate lastInspected, Coverage coverage) { super (policyNumber, premium, customer); this.address = address; this.zipCode = zipCode; this.constructionDate = constructionDate; this.lastInspected = lastInspected; this.coverage = coverage; } @Override public boolean transfer(Customer newCustomer) { // Do not transfer if no inspection in last year. if (this.lastInspected.compareTo(LocalDate.now().minusDays (365)) > 0) { this.customer = newCustomer; return true; } return false; } public string getaddress() { return address; public void setAddress(String address) { this.address = address; } public int getZipCode() { return zipcode; } public void setzipcode(int zipCode) { this.zipcode = zipcode; } public LocalDate getconstructionDate() { return constructionDate; } public void setConstructionDate(LocalDate constructionDate) { this.constructionDate = constructionDate; } public LocalDate getLastInspected() { return lastInspected; public void setLastInspected(LocalDate lastInspected) { this.lastInspected = lastInspected; } public Coverage getCoverage() { return coverage; } public void setCoverage (Coverage coverage) { this.coverage = coverage; } @Override public String tostring() { return "HomePolicy [address=" + address + ", zipCode=" + zipcode + ", constructionDate=" + constructionDate + ", lastInspected=" + lastInspected + ", coverage=" + coverage + ", customer=" + customer + "]"; } } package insurance; import java.time. LocalDate; import java.time. LocalDateTime; import java.util.HashMap; public abstract class Policy implements Displayable { private String policyNumber; private double premium; protected Customer customer; private HashMap claims = new HashMap(); public Policy(string policyNumber, double premium, Customer customer) { this.policyNumber = policyNumber; this.premium = premium; this.customer = customer; } public void fileclaim(Claim claim) { this.claims.put(claim.getclaimID(), claim); } public void fileclaim(String claimID, String firstName, string lastName, claim.claimType claimType, LocalDate claimbate, double amountsought, String description) { if (claimID == null) { // new claim Claim newclaim = new Claim(firstName, lastName, claimType, claimbate, amountsought, description); this.claims.put(newclaim.getclaimID(), newclaim); } else { claim oldclaim = claims.get(claimID); if (!oldclaim.getDescription().equals(description)) { oldclaim.setDescription(oldclaim.getDescription() + " " + LocalDateTime.now() + ": " + description); } if (!oldclaim.getFirstName().equals(firstName)) { oldclaim.setDescription(oldclaim.getDescription() + Former first name: + oldclaim.getFirstName()); oldclaim. setFirstName(firstName); } Former last name: " + oldclaim.getLastName(); if (!oldclaim.getLastName().equals(lastName)) { oldclaim.setDescription(oldclaim.getDescription() + oldclaim.setLastName(lastName); } // and maybe more stuff } } public string getPolicyNumber() { return policyNumber; } public void setPolicyNumber(String policyNumber) { this.policyNumber = policyNumber; } public double getPremium() { return premium; } public void setPremium(double premium) { this.premium = premium; } public Customer getCustomer() { return customer; } public void setCustomer (Customer customer) { this.customer = customer; } public HashMap getclaims () { return claims; } public void setclaims (HashMap claims) { this.claims = claims; } } UML Sequence Diagrams You will examine Java source code for an insurance project and build a compliant UML sequence diagram to fully represent the private static method createCarPolicyAndClaim() in the Driver class. Please make sure that you represent the loop correctly, when all claims are displayed in the forEach() method. package insurance; public interface Accruable { public abstract void accrue(); } package insurance; public interface BorrowAgainst { public abstract double borrowAgainst(double amountRequested); } package insurance; import javax.swing.JFrame; import javax.swing.JoptionPane; public interface Displayable { public default void display() { JFrame frame = new JFrame("Florida National Insurance Company"); JOptionPane.showMessageDialog(frame, this.tostring()); } } package insurance; import java.time. LocalDate; public class Driver { public static void main(String[] args) { createCarPolicyAndclaim(); } private static void createCarPolicyAndclaim() { // First make a customer Customer hugo = new Customer(132991928L, "Hugo", "Weaving", "weaving@matrix.org", "6092281836"); // Then make and display a car policy for the customer CarPolicy p = new CarPolicy("FDW-192", 200000, hugo, 34219098721431L, "Toyota", "Camry", 2020, 23900, CarPolicy.CarInsuranceType.GAP); p.display(); // Create a claim and file it against the policy Claim claim = new Claim("The", "Oracle", claim.ClaimType.FACTUAL, LocalDate.now(), 750, "Red pill swalowing."); p.fileclaim(claim); // File an update to the claim p.fileclaim("F-1001", "the", "Oracle", claim.claimType. FACTUAL, LocalDate.now(), 750, "Blue pill swalowing."); // Display all claims for the policy p.getclaims ().values().forEach(C -> c.display(); } } package insurance; public class LifePolicy extends Policy implements Accruable, BorrowAgainst { private double cashvalue; public LifePolicy (String policyNumber, double premium, Customer customer, double cashvalue) { super (policyNumber, premium, customer); this.cashvalue = cashValue; } @Override public double borrowAgainst(double amountRequested) { if (this.cashvalue > amountRequested) { return amountRequested; } else { return this.cashvalue; } } @Override public void accrue) { this.cashvalue += calculateAccrualAmount(); } private double calculateAccrualAmount() { int accrual Amount = 0; // TODO code the accrual algorithm return accrualAmount; } @Override public String tostring() { return "LifePolicy [cashvalue=" + cashvalue + ", customer=" + customer + "]"; } } package insurance; public interface Transferrable { public abstract boolean transfer(Customer newCustomer); } package insurance; import java.util.ArrayList; public class CarPolicy extends Policy implements Transferrable { public enum CarInsuranceType { LIABILITY, COLLISION, COMPREHENSIVE, GAP } private long vin; private String make; private String model; private int year; private int mileage; private CarInsuranceType type; public CarPolicy(String policyNumber, double premium, Customer customer, long vin, String make, String model, int year, int mileage, CarInsuranceType type) { super(policyNumber, premium, customer); this.vin = vin; this.make = make; this.model = model; this.year = year; this.mileage = mileage; this.type = type; } @override public boolean transfer(Customer newCustomer) { this.customer = newCustomer; return true; } public long getvin() { return vin; } public void setvin(long vin) { this.vin = vin; } public String getMake() { return make; } public void setMake(String make) { this.make = make; } public string getModel() { return model; } public void setModel(String model) { this.model = model; } public int getYear() { return year; } public void setyear(int year) { this.year = year; } public int getMileage() { return mileage; } public void setMileage(int mileage) { this.mileage = mileage; } public Car InsuranceType getType() { return type; } public void setType(CarInsuranceType type) { this.type = type; } @Override public String tostring() { return "CarPolicy (vin=" + vin + ", make=" + make + ", model=" + model + year=" + year + ", mileage=" + mileage + , type=" + type + ". customer=" + customer + "]"; } } package insurance; import java.time. LocalDate; import javax.swing. JFrame; import javax.swing. JoptionPane; public class claim implements Displayable { public enum ClaimType { DEFINITIONAL, FACTUAL, POLICY, VALUE } private String claimID; private String firstName; private String lastName; private claimType claimType; private LocalDate claimDate; private double amountsought; private String description; private static int lastclaimID = 1000; public claim(String firstName, string lastName, claimType claimType, LocalDate claimbate, double amountsought, string description) { this.claimID = claimType.name().charAt(0) + "-" + ++lastclaimID; this.firstName = firstName; this.lastName = lastName; this.claimType = claimType; this.claimDate = claimDate; this.amountsought = amount sought; this.description = description; } public String getclaimID() { return claimID; } public void setclaimID(String claimID) { this.claimID = claimID; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public string getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public claimType getclaimType() { return claimType; } public void setclaimType(ClaimType claimType) { this.claimType = claimType; } public LocalDate getclaimDate() { return claimDate; } public void setclaimDate(LocalDate claimDate) { this.claimDate = claimDate; } public double getAmount sought() { return amount sought; } public void setAmountsought(double amountsought) { this.amountsought = amountsought; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } 11 @Override public string tostring() { return "Claim [claimID=" + claimID + ", firstName=" + firstName + ", lastName=" + lastName + + claimType + ", claimDate=" + claimDate + ", amountsought=" + amountsought + + description + "]"; } claimType=" ", description" @Override public void display() { // change the default implementation JFrame frame = new JFrame("Florida National Insurance Company"); String claimInfo = "Claim #" + this.claimID + " " + this.description; JOptionPane.showMessageDialog(frame, claimInfo); } } package insurance; public class Customer { private long ssn; private String firstName; private String lastName; private String email; private string phone; public Customer(long ssn, string firstName, string lastName, string email, String phone) { this.ssn = ssn; this.firstName = firstName; this.lastName = lastName; this.email = email; this.phone = phone; } public long getssn() { return ssn; } public void setssn(long ssn) { this.ssn = ssn; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public string getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } @Override public String tostring() { return "Customer (ssn=" + ssn + ", firstName=" + firstName + ", lastName=" + lastName + ", + ", phone=" + phone + "]"; } email=" + email } package insurance; import java.time. LocalDate; import java.util.ArrayList; public class HomePolicy extends Policy implements Transferrable { public enum Coverage { CASH_VALUE, REPLACEMENT, ALL_RISK } String address; int zipcode; LocalDate constructionDate; LocalDate lastInspected; Coverage coverage; public HomePolicy(String policyNumber, double premium, Customer customer, string address, int zipcode, LocalDate constructionDate, LocalDate lastInspected, Coverage coverage) { super (policyNumber, premium, customer); this.address = address; this.zipCode = zipCode; this.constructionDate = constructionDate; this.lastInspected = lastInspected; this.coverage = coverage; } @Override public boolean transfer(Customer newCustomer) { // Do not transfer if no inspection in last year. if (this.lastInspected.compareTo(LocalDate.now().minusDays (365)) > 0) { this.customer = newCustomer; return true; } return false; } public string getaddress() { return address; public void setAddress(String address) { this.address = address; } public int getZipCode() { return zipcode; } public void setzipcode(int zipCode) { this.zipcode = zipcode; } public LocalDate getconstructionDate() { return constructionDate; } public void setConstructionDate(LocalDate constructionDate) { this.constructionDate = constructionDate; } public LocalDate getLastInspected() { return lastInspected; public void setLastInspected(LocalDate lastInspected) { this.lastInspected = lastInspected; } public Coverage getCoverage() { return coverage; } public void setCoverage (Coverage coverage) { this.coverage = coverage; } @Override public String tostring() { return "HomePolicy [address=" + address + ", zipCode=" + zipcode + ", constructionDate=" + constructionDate + ", lastInspected=" + lastInspected + ", coverage=" + coverage + ", customer=" + customer + "]"; } } package insurance; import java.time. LocalDate; import java.time. LocalDateTime; import java.util.HashMap; public abstract class Policy implements Displayable { private String policyNumber; private double premium; protected Customer customer; private HashMap claims = new HashMap(); public Policy(string policyNumber, double premium, Customer customer) { this.policyNumber = policyNumber; this.premium = premium; this.customer = customer; } public void fileclaim(Claim claim) { this.claims.put(claim.getclaimID(), claim); } public void fileclaim(String claimID, String firstName, string lastName, claim.claimType claimType, LocalDate claimbate, double amountsought, String description) { if (claimID == null) { // new claim Claim newclaim = new Claim(firstName, lastName, claimType, claimbate, amountsought, description); this.claims.put(newclaim.getclaimID(), newclaim); } else { claim oldclaim = claims.get(claimID); if (!oldclaim.getDescription().equals(description)) { oldclaim.setDescription(oldclaim.getDescription() + " " + LocalDateTime.now() + ": " + description); } if (!oldclaim.getFirstName().equals(firstName)) { oldclaim.setDescription(oldclaim.getDescription() + Former first name: + oldclaim.getFirstName()); oldclaim. setFirstName(firstName); } Former last name: " + oldclaim.getLastName(); if (!oldclaim.getLastName().equals(lastName)) { oldclaim.setDescription(oldclaim.getDescription() + oldclaim.setLastName(lastName); } // and maybe more stuff } } public string getPolicyNumber() { return policyNumber; } public void setPolicyNumber(String policyNumber) { this.policyNumber = policyNumber; } public double getPremium() { return premium; } public void setPremium(double premium) { this.premium = premium; } public Customer getCustomer() { return customer; } public void setCustomer (Customer customer) { this.customer = customer; } public HashMap getclaims () { return claims; } public void setclaims (HashMap claims) { this.claims = claims; } }

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!