Question: You will basically have to pay attention to the access modifiers and things that are static. Methods should be fully described with their return types
You will basically have to pay attention to the access modifiers and things that are static. Methods should be fully described with their return types and full parameters. You also have to build a model such constructs as abstract classes, abstract methods and interfaces (making sure to display the methods). YOU CAN HAND DRAW THEM
You will examine Java source code for an insurance project and build a compliant UML class diagram to represent all of the classes and interfaces (except the Driver class). You do not need to create operations (methods) for standard getters, setters, constructors or toStrings.
Use StarUML(or Visio or draw by hand) to build the diagrams, but then please insert screenshots (or pictures if drawn by hand) into a Word or PDF document.
Even though some of these concepts might not be covered yet, it will be important to model such constructs as abstract classes, abstract methods and interfaces (making sure to display the methods).
Pay attention to the access modifiers and things that are static. Methods should be fully described with their return types and full parameters.
Note:
If class A extends class B, then class A is a subclass of class B
If class A implements Interface B, then class A is a subclass of class B.
Accruable FILE
package insurance;
public interface Accruable { public abstract void accrue();
}
Borrow Against FILE
package insurance;
public interface BorrowAgainst {
public abstract double borrowAgainst(double amountRequested);
}
Transferrable FILE
package insurance;
public interface Transferrable {
public abstract boolean transfer(Customer newCustomer); }
Car Policy FILE
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 CarInsuranceType 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 + "]"; } }
Claim FILE
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 claimDate, 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 = amountSought; 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 getAmountSought() { return amountSought; }
public void setAmountSought(double amountSought) { this.amountSought = amountSought; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
@Override public String toString() { return "Claim [claimID=" + claimID + ", firstName=" + firstName + ", lastName=" + lastName + ", claimType=" + claimType + ", claimDate=" + claimDate + ", amountSought=" + amountSought + ", description=" + 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); } }
Displayable FILE
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()); } }
JAVA CODING
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
