public class Customer
{
	private String name;
	private String address;
	private double totalPurchase;
	private double invoiceAmount;

	public Customer(String name, String address)
	{
		this.name = name;
		this.address = address;
		totalPurchase = 0.0;
		invoiceAmount = 0.0;
	}

	public String getName()  						
	{												
		return name;
	}

	public String getAddress()
	{
		return address;
	}

	public double getTotalPurchase()
	{
		return totalPurchase;
	}

	public double getInvoiceAmount()				
	{												
		invoiceAmount = totalPurchase * 1.0775;    
		return invoiceAmount;
	}

	public void updateTotalPurchase(double amount)	provided
	{												
		totalPurchase += amount;				
	//	return totalPurchase;
	//  totalPurchase = totalPurchase + amount;
	}
}

Above Code has no error but i am stuck on this class below as its not compling

public class DellCustomer
{
	public static void main(Stirng[] args)
	{
		Customer neel = new Customer("Neel Smith");

		System.out.println("The customer name is " + neel.getName());
		System.out.println("The customer address is" + neel.getAddress());
		System.out.println("The customer Totoal Purchase is" + neel.getTotalPurchase());
 	}
}

Here the error i get in this code

F:\JAVA\Java Files\Lab3\DellCustomer.java:3: cannot find symbol
symbol  : class Stirng
location: class DellCustomer
	public static void main(Stirng[] args)
	                        ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:5: cannot find symbol
symbol  : constructor Customer(java.lang.String)
location: class Customer
		Customer neel = new Customer("Neel Smith");
		                ^
2 errors

Tool completed with exit code 1

Please help me how to solve the error..

thanks for the help in advance

Recommended Answers

All 10 Replies

F:\JAVA\Java Files\Lab3\DellCustomer.java:3: cannot find symbol
symbol  : class Stirng
location: class DellCustomer
    public static void main(Stirng[] args)

Just a spelling error - I think you mean String.
^

F:\JAVA\Java Files\Lab3\DellCustomer.java:5: cannot find symbol
symbol  : constructor Customer(java.lang.String)
location: class Customer
        Customer neel = new Customer("Neel Smith");
                        ^

Look again at your Customer class constructor and compare that to the constructor (parameters) that you are using.

Just a spelling error - I think you mean String.
^

Look again at your Customer class constructor and compare that to the constructor (parameters) that you are using.

I fix those errors now I am some new error. what does it mean please help

here is the updated class

public class DellCustomer
{
	public static void main(String[] args)
	{
		Customer neel = new Customer("Neel Smith", "255 gentle knoll way");
		Customer jack = new Customer("Jack Solo", "955 pleasant goway");

        neel.setTotalPurchase(5);
        neel.setTotalPurchase(7);
        neel.setInvoiceAmount(50.0);
        neel.setInvoiceAmount(140.0);
		System.out.println("The customer name is " + neel.getName());
		System.out.println("The customer address is" + neel.getAddress());
		System.out.println("The Custome Invoice Amt is" + neel.getInvoiceAmount());
		System.out.println("The customer Totoal Purchase is" + neel.getTotalPurchase());

		jack.setTotalPurchase(1);
        jack.setTotalPurchase(4);
	    jack.setTotalPurchase(6);
	    jack.setInvoiceAmount(10.00);
	    jack.setInvoiceAmount(100.0);
        jack.setInvoiceAmount(500.0);
		System.out.println("The customer name is " + jack.getName());
		System.out.println("The customer address is" + jack.getAddress());
		System.out.println("The Custome Invoice Amt is" + jack.getInvoiceAmount());
		System.out.println("The customer Totoal Purchase is" + jack.getTotalPurchase());
 	}
}

here are the errors i get

F:\JAVA\Java Files\Lab3\DellCustomer.java:8: cannot find symbol
symbol  : method setTotalPurchase(int)
location: class Customer
        neel.setTotalPurchase(5);
            ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:9: cannot find symbol
symbol  : method setTotalPurchase(int)
location: class Customer
        neel.setTotalPurchase(7);
            ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:10: cannot find symbol
symbol  : method setInvoiceAmount(double)
location: class Customer
        neel.setInvoiceAmount(50.0);
            ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:11: cannot find symbol
symbol  : method setInvoiceAmount(double)
location: class Customer
        neel.setInvoiceAmount(140.0);
            ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:17: cannot find symbol
symbol  : method setTotalPurchase(int)
location: class Customer
		jack.setTotalPurchase(1);
		    ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:18: cannot find symbol
symbol  : method setTotalPurchase(int)
location: class Customer
        jack.setTotalPurchase(4);
            ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:19: cannot find symbol
symbol  : method setTotalPurchase(int)
location: class Customer
	    jack.setTotalPurchase(6);
	        ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:20: cannot find symbol
symbol  : method setInvoiceAmount(double)
location: class Customer
	    jack.setInvoiceAmount(10.00);
	        ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:21: cannot find symbol
symbol  : method setInvoiceAmount(double)
location: class Customer
	    jack.setInvoiceAmount(100.0);
	        ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:22: cannot find symbol
symbol  : method setInvoiceAmount(double)
location: class Customer
        jack.setInvoiceAmount(500.0);
            ^
10 errors

Tool completed with exit code 1
here what i have to do with this class as told by my prof
1.  the main method

2.   two customer objects

3.  The first customer (use any name and address you like) made two purchases with the amount of 50.0 and 140.0.

4.  The second customer made three purchases: 10.0, 100.0, and 500.0.

5. display both customers' information.

thank for help in adavnce

It is exactly what is says

cannot find symbol : method setTotalPurchase(int)

You have no set methods only get. So create set which will store your data in your Customer class

as told i did set method in customer class and got no error but in dellcustomer class i got some error dont know why

public double setTotalPurchase()
	{
		totalPurchase = 5 & 7 & 1 & 4 & 6;
		return totalPurchase;
	}

	public double setInvoiceAmount()
	{
		 invoiceAmount = 50 & 140  & 10 & 100 & 500;
	     return invoiceAmount;
	}
Heres the error i got in dellcustomer class...

F:\JAVA\Java Files\Lab3\DellCustomer.java:8: getTotalPurchase() in Customer cannot be applied to (int)
        neel.getTotalPurchase(5);
            ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:9: getTotalPurchase() in Customer cannot be applied to (int)
        neel.getTotalPurchase(7);
            ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:10: getInvoiceAmount() in Customer cannot be applied to (double)
        neel.getInvoiceAmount(50.0);
            ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:11: getInvoiceAmount() in Customer cannot be applied to (double)
        neel.getInvoiceAmount(140.0);
            ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:17: getTotalPurchase() in Customer cannot be applied to (int)
		jack.getTotalPurchase(1);
		    ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:18: getTotalPurchase() in Customer cannot be applied to (int)
        jack.getTotalPurchase(4);
            ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:19: getTotalPurchase() in Customer cannot be applied to (int)
	    jack.getTotalPurchase(6);
	        ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:20: getInvoiceAmount() in Customer cannot be applied to (double)
	    jack.getInvoiceAmount(10.00);
	        ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:21: getInvoiceAmount() in Customer cannot be applied to (double)
	    jack.getInvoiceAmount(100.0);
	        ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:22: getInvoiceAmount() in Customer cannot be applied to (double)
        jack.getInvoiceAmount(500.0);
            ^
10 errors

please help thanks

You are not passing the parameters in your setters but in your getters so all these errors.

Just make changes like

public void setTotalPayment(double d){
          totalPayment = ;//or whatever you logic is to calculate the total payment
}

Similarly for getters,

public double getTotalPayment(){
    return totalPayment;
}

I made some changes to customer class and dell customer class and both would compliie but when i run the java program it would not calculate it, it would just display total purchase and invoice amt to 0.00 even if i changes the number in dellcustomer class. is there something wrong or what please let me know

here my customer class and dell customer class

public class Customer
{
	private String name;
	private String address;
	private double totalPurchase;
	private double invoiceAmount;

	public Customer(String name, String address)
	{
		this.name = name;
		this.address = address;
		totalPurchase = 0.0;
		invoiceAmount = 0.0;
	}

	public String getName()  						// returns customer name to
	{												// the calling class
		return name;
	}

	public String getAddress()
	{
		return address;
	}

	public double getTotalPurchase()
	{
		return totalPurchase;
	}

	public double getInvoiceAmount()				// calculates invoice amount and
	{												// returns the total billing amount
		invoiceAmount = totalPurchase * 1.0775;     // to the calling class
		return invoiceAmount;
	}

	public void updateTotalPurchase(double amount)	// takes a new purchase amount provided
	{												// by the calling class and adds the
		totalPurchase += amount;					// amount to a customer's total purchase
	//	return totalPurchase;
	//  totalPurchase = totalPurchase + amount;
	}
	public double setTotalPurchase(double TotalPurchase)
	{
		if ((TotalPurchase <= 6.0 ) && ( TotalPurchase >= 1.00));
		return totalPurchase;

	}

	public double setInvoiceAmount(double InvoiceAmount)
	{
		 if ((InvoiceAmount <= 500.0 ) && ( InvoiceAmount >= 1.00));
		 return invoiceAmount = totalPurchase * 1.0775;
	}

}
public class DellCustomer
{
	public static void main(String[] args)
	{
		Customer neel = new Customer("Neel Smith", "255 gentle knoll way");
		Customer jack = new Customer("Jack Solo", "955 pleasant goway");

        neel.setTotalPurchase(7.0);
        neel.setInvoiceAmount(100.0);

		System.out.println("The customer name is " + neel.getName() + "\n");
		System.out.println("The customer address is" + neel.getAddress() + "\n");
		System.out.println("The Custome Invoice Amt is" + neel.getInvoiceAmount() + "\n");
		System.out.println("The customer Totoal Purchase is" + neel.getTotalPurchase() + "\n");

		jack.setTotalPurchase(6.0);
        jack.setInvoiceAmount(400.0);
		System.out.println("The customer name is " + jack.getName() + "\n");
		System.out.println("The customer address is" + jack.getAddress() + "\n");
		System.out.println("The Custome Invoice Amt is" + jack.getInvoiceAmount() + "\n");
		System.out.println("The customer Totoal Purchase is" + jack.getTotalPurchase() + "\n");
 	}
}
Member Avatar for jtonic
public static void main(Stirng [] args)
public class Customer
{
    private String name;
    private String address;
    private double totalPurchase;
    private double invoiceAmount;

    public Customer(String name, String address)
    {
        this.name = name;
        this.address = address;
        totalPurchase = 0.0;
        invoiceAmount = 0.0;
    }

    public String getName()                         
    {                                               
        return name;
    }

    public String getAddress()
    {
        return address;
    }

    public double getTotalPurchase()
    {
        return totalPurchase;
    }

    public double getInvoiceAmount()                
    {                                               
        invoiceAmount = totalPurchase * 1.0775;    
        return invoiceAmount;
    }

    public void updateTotalPurchase(double amount)  provided
    {                                               
        totalPurchase += amount;                
    //  return totalPurchase;
    //  totalPurchase = totalPurchase + amount;
    }
}

Above Code has no error but i am stuck on this class below as its not compling

public class DellCustomer
{
    public static void main(Stirng[] args)
    {
        Customer neel = new Customer("Neel Smith");

        System.out.println("The customer name is " + neel.getName());
        System.out.println("The customer address is" + neel.getAddress());
        System.out.println("The customer Totoal Purchase is" + neel.getTotalPurchase());
    }
}

Here the error i get in this code

F:\JAVA\Java Files\Lab3\DellCustomer.java:3: cannot find symbol
symbol  : class Stirng
location: class DellCustomer
    public static void main(Stirng[] args)
                            ^
F:\JAVA\Java Files\Lab3\DellCustomer.java:5: cannot find symbol
symbol  : constructor Customer(java.lang.String)
location: class Customer
        Customer neel = new Customer("Neel Smith");
                        ^
2 errors

Tool completed with exit code 1

Please help me how to solve the error..

thanks for the help in advance[/QUOTE]

Member Avatar for iamthwee

Problems with typos and the number of parameters you're passing.

How can you not see that from the compiler errors?

Any number multiplied by 0 is always 0.

Any number multiplied by 0 is always 0.

Not necessarilly when we're talking about computers and floating point mathematics.
You could run into rounding errors causing one or the other and/or the result to not really be 0 (at least as represented in computer memory).

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.