Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java Mod 7

apbmitch
apbmitch 


I need help with writing code. I have to finish up writing one and another one that I haven't started yet. I will post all documents pertaining to it and I need as much help as possible. I need it by before Saturday 5:00 AM EST. 12/05/2015 Thanks. Attachments Tags Clarifications

Answers

Solution for Insurance and Distribution Program

ravi_singh
ravi_singh 



Hi apbmitch,
i have added solution for both programs
first part needs following files
1)Insurance.java
2)TrackInsurance.java
3)Customer.java
4)ArtInsurance.java
5)AutoInsurance.java
6)HealthInsurance.java
7)LifeInsurance.java
second part needs following file
1)Distribution.java
2)input.txt

I have attached the screenshot of sample run for Distribution program
as the sample run for Insurance program was large i have added that run in text file run.txt
Please check it out.
and please ask if you have any doubt.
if you have any doubts please mail me at ravi.kmr.singh8[at]gmail.com
Attachments
ArrayEx.java (1 K) Download Preview
csc201mod6ANSWERS; public class ArrayEx { public static

input.txt (1 K) Download Preview
9 3 4 2 3

Customers.txt (1 K) Download
Insurance.txt (5 K) Download Preview
HALF_EVENsrjava.text.DecimalFormatSymbolsP?h??CdecimalSeparatorCdigitC exponentialCgroupingSeparatorC minusSignCmonetarySeparatorCpatternSeparatorCperMillCpercentIserialVersionOnStreamC zeroDigitLNaNq~LcurrencySymbolq~LexponentialSeparatorq~Linfinityq~LintlCurrencySymbolq~LlocaletLjava/util/Locale;xp.#E,-.; 0%0t?tRs.tEt8tINRsrjava.util.Locale~?`?0??IhashcodeLcountryq~L extensionsq~Llanguageq~Ls

ArtInsurance.java (1 K) Download 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) Download 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) Download 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) Download 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) Download 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) Download 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) Download Preview
void play() { } public void replaceBattery() { } public void moveArms() { } public void walk() { } } class RoboSapien extends

TrackInsurance.java (9 K) Download 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) Download 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) Download Preview

Distribution.java (1 K) Download 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) Download Preview

Screenshots
Screenshot
Screenshot
Purchase Answer