i have more files that are needed in this assignment. i have attached only the main page of assignment requirement.

1 answer below »
i have more files that are needed in this assignment. i have attached only the main page of assignment requirement.

Answered Same DayOct 22, 2021

Answer To: i have more files that are needed in this assignment. i have attached only the main page of...

Neha answered on Nov 01 2021
161 Votes
customer/CustomerDetail.class
public synchronized class CustomerDetail {
public String custCode;
public String custName;
public String custContact;
public String custAddress1;
public String custAddress2;
public String custPcode;
public void CustomerDetail(String);
public void CustomerDetail(String, String, String, String, String, String);
public String toString();
}
customer/CustomerDetail.ctxt
#BlueJ class context
comment0.target=CustomerDetail
comment1.params=custCode
comment1.target=CustomerDetail(java.lang.String)
comment2.params=custCode\ custName\ custContact\ custAddress1\ custAddress2\ custPcode
comment2.target=CustomerDetail(java.lang.String,\ java.lang.St
ring,\ java.lang.String,\ java.lang.String,\ java.lang.String,\ java.lang.String)
comment3.params=
comment3.target=java.lang.String\ toString()
numComments=4
customer/CustomerDetail.java
customer/CustomerDetail.java
 
// listen to the lecture in week 10 for details
public class CustomerDetail
{
    public String custCode=""; // The customer code 
    public String custName=""; // The customer business name 
    public String custContact=""; // The customer contact person name 
    public String custAddress1=""; // The customer address line 1 
    public String custAddress2=""; // The customer address line 2
    public String custPcode=""; // The customer post code 


    // Partial constructor to keep it on 1 line and re-use code from MT1
    public CustomerDetail(String custCode)
    {
    this.custCode=custCode.trim();
    }

    // Full proper constructor to keep it on 1 line and re-use code from MT1
    public CustomerDetail(String custCode, String custName, String custContact, String custAddress1,
                    String custAddress2, String custPcode)
    {
    this.custCode=custCode.trim();
    this.custName=custName; // The customer business name 
    this.custContact=custContact; // The customer contact person name 
    this.custAddress1=custAddress1; // The customer address line 1 
    this.custAddress2=custAddress2; // The customer address line 2
    this.custPcode=custPcode;
    }

    public String toString() 
    {
         String retv = custCode;
         retv = retv +"="+custName+":"+custContact+":"+custAddress1+":"+custAddress2+":"+custPcode;
         return retv;
    }
}
customer/CustomerList.class
public synchronized class CustomerList {
CustomerDetail[] custList;
public void CustomerList();
public CustomerDetail findCustomer(String);
}
customer/CustomerList.ctxt
#BlueJ class context
comment0.target=CustomerList
comment1.params=
comment1.target=CustomerList()
comment2.params=custCode
comment2.target=customer.CustomerDetail\ findCustomer(java.lang.String)
numComments=3
customer/CustomerList.java
customer/CustomerList.java
 
// listen to the lecture in week 10 for details
public class CustomerList
{
    CustomerDetail[] custList;

    public CustomerList()
    {
      custList = new CustomerDetail[7];

      // this is how it should be done
      custList[0] = new CustomerDetail("MARZ","The Mars Gen Inc","Cool Dude","26 O’Conner’s Road",
                                 "Werribee South VIC","3030");

      // this is re-using code (cut and paste)
      CustomerDetail c = new CustomerDetail("ESAA");
      c.custName="Europe Systems Alternative Agency";  // The customer business name 
      c.custContact="Jean-Claude Junxer"; // The customer contact person name 
      c.custAddress1="23 Razor Road"; // The customer code 
      c.custAddress2="Belconnen ACT"; // The customer code 
      c.custPcode="2617"; // The customer code 
      custList[1]=c;
      c = new CustomerDetail("NASHA");
      c.custName ="National Air Space Hash Agency"; // The customer business name 
      c.custContact ="Jimmy Briden"; // The customer contact person name 
      c.custAddress1 ="2 Mashup Drive"; // The customer code 
      c.custAddress2 ="Bruce ACT"; // The customer code 
      c.custPcode ="2617"; // The custo
      custList[2]=c;

      c = new CustomerDetail("ASA");
      c.custName="Aussie Space Agency"; // The customer business name 
      c.custContact="Megan Clock"; // The customer contact person name 
      c.custAddress1="Flat 31/a, Bax Units"; // The customer code 
      c.custAddress2="Stix St Marble Bar"; // The customer code 
      c.custPcode="6760"; // The customer code 
      custList[3]=c;

      c = new CustomerDetail("TICK");
      c.custName="Tick Incorporated"; // The customer business name 
      c.custContact="Mark Watson"; // The customer contact person name 
      c.custAddress1="87 Race drive "; // The customer code 
      c.custAddress2="Bathurst"; // The customer code 
      c.custPcode="2795"; // The cust
      custList[4]=c;
      c = new CustomerDetail("BINC");
      c.custName="Byer private space Incorporated"; // The customer business name 
      c.custContact="Marillyn Hewson"; // The customer contact person name 
      c.custAddress1="212 webly drive"; // The customer code 
      c.custAddress2="Canowindra NSW"; // The customer code 
      c.custPcode="2804"; // The customer code 
      custList[5]=c;
      c = new CustomerDetail("CODC");
      c.custName="Corporate space Trust"; // The customer business name 
      c.custContact="Zhang Chen"; // The customer contact person name 
      c.custAddress1="212 Scorch drive"; // The customer code 
      c.custAddress2="Beltana SA"; // The customer code 
      c.custPcode="5730"; // The customer code 
      custList[6]=c;

    }

    public CustomerDetail findCustomer(String custCode)
    {
        //simple array search

        for (int i=0; i< 7 ; i++)
        {
            if (custList[i].custCode.compareToIgnoreCase(custCode.trim())==0) return custList[i];
        }
        return null;
    }
}
customer/CustomerListTestClass.class
public synchronized class CustomerListTestClass {
CustomerList cl;
CustomerDetail cust;
public void CustomerListTestClass();
}
customer/CustomerListTestClass.ctxt
#BlueJ class context
comment0.target=CustomerListTestClass
comment1.params=
comment1.target=CustomerListTestClass()
numComments=2
customer/CustomerListTestClass.java
customer/CustomerListTestClass.java
 
public class CustomerListTestClass
{
    CustomerList cl;
    CustomerDetail cust;

    public CustomerListTestClass()
    {
        System.out.println("\u000c");
        cl=new CustomerList();

        cust = cl.findCustomer("BINC");
        System.out.println(cust.toString());
        System.out.println();

        System.out.println(cust.custCode+":"+cust.custName+":"+cust.custContact+":\n"+cust.custAddress1+":"+
                           cust.custAddress2+":"+cust.custPcode);

    }
}
customer/launch.class
public synchronized class launch {
public void launch();
public static void main(String[]);
}
customer/launch.ctxt
#BlueJ class context
comment0.target=launch
comment0.text=\r\n\r\n\ @author\ Raghav\r\n
comment1.params=args
comment1.target=void\...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here