ArrayEx.java (1 K)
Preview
csc201mod6ANSWERS;
public class ArrayEx {
public static
input.txt (1 K)
Preview
9
3 4
2 3
Customers.txt (1 K)
Insurance.txt (5 K)
Preview
HALF_EVENsr java.text.DecimalFormatSymbolsP?h?? C decimalSeparatorC digitC exponentialC groupingSeparatorC minusSignC monetarySeparatorC patternSeparatorC perMillC percentI serialVersionOnStreamC zeroDigitL NaNq ~ L currencySymbolq ~ L exponentialSeparatorq ~ L infinityq ~ L intlCurrencySymbolq ~ L localet Ljava/util/Locale;xp . # E , - . ; 0 % 0t ?t Rs.t Et 8t INRsr java.util.Locale~?`?0?? I hashcodeL countryq ~ L
extensionsq ~ L languageq ~ L s
ArtInsurance.java (1 K)
Preview
}
// we override the toString method from the Insurance class
public String toString() {
// add on the info for this class
return super.toString() +
(" for art insurance. The art work is \"" + artDescription + "\", and the value is " + currency.format(valueArtWork) + ".");
}
//
AutoInsurance.java (1 K)
Preview
from a file
public AutoInsurance (Customer cust, int polNum, double yrRate, int numC) {
super(cust, polNum, yrRate);
numCars = numC;
}
// we were required to write a complete calcRate method by the abstract method in the
// Insurance class. Must have the exact same signature
public void calcRate() {
Customer.java (2 K)
Preview
a new customer
* Creates a new unique id for them
* @param custLast - Customer last name
* @param custFirst - Customer first name
*/
public Customer(String custLast, String custFirst) {
last = custLast;
first = custFirst;
id = num;
num++;
}
/**
* empty constructor but still creates
HealthInsurance.java (1 K)
Preview
public HealthInsurance(Customer cust, int dependents) {
// you code the body
super(cust);
numDependents = dependents;
calcRate();
}
// full constructor if read from a file
public HealthInsurance(Customer cust, int polNum, double yrRate, int numD) {
super(cust, polNum, yrRate);
numDependents = numD;
}
// empty constructor
public HealthInsurance() {
}
//
Insurance.java (2 K)
Preview
, they must be protected (private allows NO other classes
// to use them) - protected means this class and any class that inherits
// from this one can use these
protected Customer customer;
protected double yearlyRate;
protected int policyNumber;
// for currency output
NumberFormat currency = NumberFormat.getCurrencyInstance();
// a
LifeInsurance.java (1 K)
Preview
you code the body
return super.toString() +
" for life insurnace. The amount of insurance wanted is " + currency.format(amount) + ", and the age is " + age + ".";
}
// generate the getters and setters
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
Robot.java (1 K)
Preview
void play() {
}
public void replaceBattery() {
}
public void moveArms() {
}
public void walk() {
}
}
class RoboSapien extends
TrackInsurance.java (9 K)
Preview
you need to just slug out some code.
// Look at the bubble sort from the SortByHand in the search_sort package
// You will want to do something similar
// Here is some pseudocode to help
//
public static void sortCustNum(ArrayList<Insurance> insure) {
for (int out = insure.size() - 1;
run.txt (9 K)
Preview
information (call the toString method)
3. Given a policy number, print the policy information
4. Find all of the policies for a given customer
5. Sort the insurance policy information by customer number
6. Sort the insurance policy information by policy number
7. QUIT!!
runIns.png (23 K)
Preview
Distribution.java (1 K)
Preview
num[value]++;
sum+=value;
numValues++;
}
System.out.println("Following is the distribution of values");
for(int i=1;i<10;i++){
System.out.println(i+" -
dist.PNG (3 K)
Preview