• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

what am I doing wrong? help please

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, how are you guys? I need some help on this. I am trying to put two classes together but something is wrong I cant figure out how to fix it. Somebody can help me please? Thank you so much

I have these two classes Customer with some informaton such as companyName,contact name, customer ID and address. Ans another one is ShippingLabel with the following String custInfo = "Toys'R'Us;Lionel Giraffe;12345;101 Toy Lane, Boulder, Colorado 80301";


//set up a customer and print a shipping label.

class Customer{
private String companyName;
private String customerContactName;
private String customerID;
private String address;

//default customer
Customer()
{
companyName= "Knows Toys";
customerContactName = "Lester Jones";
customerID = "000";
address = "(Internal Shipment) Chicago, Illinois";
}
//.......................
Customer(String company, String person, String id, String location)
{
companyName= company.trim();
customerContactName = person.trim();
customerID = id.trim();
address = location.trim();
}

class shippingLabel{


public String createShippingLabel()
{
String label = "\n" + companyName + " (Customer Order Number: " + customerID +
")\n" + customerContactName + "\n" + address;
return label;
}

}
// driver for this application

public static void main(String args[])
{
// Shipping label
Customer first = new Customer(String Know Toys, String Lester Jones, String 000, String (Internal Shipment) Chicago, Illinois);
System.out.println(first.createShippingLabel());


Customer tester = new Customer();
tester.display();

//call on the display method
System.exit(0);
}


class public Customer {

public static void main(String args[]) {
// Shipping lable
String custInfo = "Toys'R'Us;Lionel Giraffe;12345;101 Toy Lane, Boulder, Colorado 80301";
String[] array = custInfo.split(";");
Customer first = new Customer(array[0], array[1], array[2], array[3]);
System.out.println(first.createShippingLabel());


ShippingLabel tester = new ShippingLabel());
tester.display();

//call on the display method
System.exit(0);
}
}
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> but something is wrong

please elaborate - what is supposed to happen, and what actually happens
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hello, how are you guys? I need some help on this. I am trying to put two classes together but something is wrong I cant figure out how to fix it. Somebody can help me please? Thank you so much



From a quick glance, it is unlikely that this code will even compile -- unless you did an incorrect cut-n-paste to here.

The best way to deal with compile errors is to look at the first few errors. Check out the location (file and line number). And start there. It is best to fix only one or two, and then recompile again, as one may be causing another.

Generally, the error message is pretty self explanatory. Some are obscure. But with enough practice, they will all make sense. How about you paste the first few compile errors here, and we'll give you a hint in the right direction?

Henry
 
Whatever you say buddy! And I believe this tiny ad too:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic