there were a lot of design errors in that 'improved code'. could you show the code you have now, from your different classes in separate CODE blocks?

the Product worked but the client didnt

\\Client

import java.util.*;
import java.text.*;

public class Client { [ERROR]

private String name;
private String surname; [ERROR]
private String address_1; [ERROR]
private String address_2;[ERROR]
private String address_3;[ERROR]
private String postcode;[ERROR]
}
public Client()[ERROR]
{
name="";
surname="";[ERROR]
address_1="";[ERROR]
address_2="";[ERROR]
address_3="";[ERROR]
postcode="";[ERROR]
}


}

public Client (Client copy)[ERROR]
{
this.name=copy.name;[ERROR]
this.surname=copy.surname;[ERROR]
this.address_1=copy.address_1;[ERROR]
this.address_2=copy.address_2;[ERROR]
this.address_3=copy.address_3;[ERROR]
this.postcode=copy.postcode;[ERROR]

}

public Client(String name, String surname, String address_1, String address_2, String address_3, String postcode)
{[ERROR]
this.name=name;[ERROR]
this.surname=surname;[ERROR]
this.address_1=address_1;[ERROR]
this.address_2=address_2;[ERROR]
this.address_3=address_3;[ERROR]
this.postcode=postcode;[ERROR]
}


public String getName()[ERROR]
{
return name;[ERROR]
}


public String getSurname()[ERROR]
{
return surname;[ERROR]
}


public String getAddress_1()[ERROR]
{
return address_1;[ERROR]
}


public String getAddress_2()[ERROR]
{
return address_2;[ERROR]
}


public String getAddress_3()[ERROR]
{
return address_3;[ERROR]
}


public String getPostcode()[ERROR]
{
return postcode;[ERROR]
}


public void printArrayList()[ERROR]

{

Scanner in=new Scanner(System.in);[ERROR]

ArrayList<Client> list=new ArrayList<Client>();[ERROR]
list.add(new Client("Morgan"));[ERROR]
list.add(new Client("Cassia"));[ERROR]
list.add(new Client("Mayson Ville"));[ERROR]
list.add(new Client("Oxford Street"));[ERROR]
list.add(new Client("London"));[ERROR]
list.add(new Client("LND"));[ERROR]

System.out.println("PLACE YOUR ORDER!"); [ERROR]
System.out.println();[ERROR]


for(Client e : list){[ERROR]

System.out.println(e.getName () + "\t" + e.getSurname() + "\t" + e.getAddress_1() + "\t" + e.getAddress_2()+ "\t" + e.getAddress_3()+ "\t" + e.getPostcode());[ERROR]

\\BUSINESS

import java.util.*;
import java.text.*;

public class Business{

public static void main (String[] args) {


firstProd.printArrayList();


firsClie.printArrayList();

}
}

public static void main (String[] args) {
firstProd.printArrayList();
firsClie.printArrayList();
}

you have no firstProd and no firstClie instances of any method, so it's normal that this won't work. (as I already said: move all of the business logic out of client and product classes)

in your client, you have methods after the closing bracket of your class, so I doubt the code as you've shown above will even compile, actually, the time I first saw, was after your first constructor, but apparently, you already close your class before your first constructor.

look at your brackets and remove the ones that shouldn't be there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.