Results 1 to 9 of 9
  1. #1
    Raven9 is offline Member
    Join Date
    Apr 2011
    Posts
    8
    Rep Power
    0

    Default Do Not Understand Error Messages Java Code for Inverntory Part 3

    C:\Documents and Settings\AdminUser\My Documents\InventoryPart3.java:93: cannot find symbol
    symbol : constructor Television(int,java.lang.String,int,double)
    location: class Television
    super(ItemNumber, ProductName, UnitsStock, UnitPrice);
    ^
    C:\Documents and Settings\AdminUser\My Documents\InventoryPart3.java:120: cannot find symbol
    symbol : variable getInventoryValue
    location: class Television
    return super.getInventoryValue * 0.10;
    ^
    2 errors

    Tool completed with exit code 1



    Java Code:
        class Television { //class name and attributes
    
    	private String ItemNumber; //item # of product
    	private String ProductName; //product name
    	public double UnitsStock; //# of units in stock
    	public double UnitPrice; //Price per unit
    	private String SerialNumber; //serial number of product
    	private double InventoryValue; //The dollar value of the inventory in stock
    
    	//constructor
    
        public Television (String item, String product, double units, double price, String serial) {
    		ItemNumber = item;
    		ProductName = product;
    		UnitsStock = units;
    		UnitPrice = price;
    		SerialNumber = serial;
    
    } //end constructor
    
    ///getter and setter methods for Television
    
    	public void setItemNumber (String item) { //setter for item number
    		this.ItemNumber = item;
    	} //end setter item number
    
    	public String getItemNumber() { //getter for item number
    		return ItemNumber;
    	} //end getter item number
    
    	public void setProductName (String product) { //setter for product name
    		this.ProductName = product;
    	} //end setter product name
    
    	public String getProductName() { //getter for product name
    		return ProductName;
    	} //end getter product name
    
    	public void setUnitsStock (double units) { //setter for units in stock
    		this.UnitsStock = units;
    	} //end setter units in stock
    
    	public double getUnitsStock() { //getter for units in stock
    		return UnitsStock;
    	} //end getter units in stock
    
    	public void setUnitPrice (double price) { //setter for unit price
    		this.UnitPrice = price;
    	} //end setter unit price
    
    	public double getUnitPrice() { //getter for unit price
    		return UnitPrice;
    	} //end getter for unit price
    
    	public void setSerialNumber (String serial) { //setter for serial number
    		this.SerialNumber = serial;
    	}//end setter for serial number
    
    	public String getSerialNumber() { //getter for serial number
    		return SerialNumber;
    	}//end getter for serial number
    
    
    
    	//calculate individual product inventory value
    
    	public double getInventoryValue(){
    		return UnitsStock * UnitPrice;
    
    	}//end calculate individual product inventory value
    
    
    	//calculate total inventory value
    	public double calculateInventory(){
    		return UnitPrice * UnitsStock;
    	}//end calculate total inventory value
    
    ///end getter and setter methods for Laptop
    
    } //end class Television
    
      class Manufacturer extends Television {
    	private String manufacturerName;
    
    	//constructor
    
    	public Manufacturer(int ItemNumber, String ProductName, int UnitsStock, double UnitPrice, String mfgName) {
    
    		super(ItemNumber, ProductName, UnitsStock, UnitPrice);
    		this.manufacturerName = mfgName;
    
    	}//end constructor
    
    	//getter and setter for class Manufacturer
    
    	public void setmanufacturerName(String mfgName) {
    		this.manufacturerName = mfgName;
    	}
    
    	public String getmanufacturerName() {
    		return manufacturerName;
    	}
    
    	//end getter and setter for class Manufacturer
    
    	//calculate total inventory value
    
    	public double calculateInventory(){
    		return ((UnitPrice * UnitsStock)* .10);
    
    	}//end calculate total inventory value
    
    	//calculate restocking fee method
    
    	public double getcalculateRestockFee() {
    		return super.getInventoryValue * 0.10;
    
    	}//end calculate restocking fee method
    
    }//end class Manufacturer

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    11

    Default

    Unless you are told this is the relationship you may want to re-consider the relationship here. When you extend a class it should make sense to say
    Java Code:
    manufacturer is a television
    Does that make sense to you? It doesn't to me. This is called an is-a relationship. A has-a relationship would make more sense to me
    Java Code:
    a television has a manufacturer
    You would then make one of televisions instance variables be a manufacturer.

    As far as the error messages go, you are calling super and passing it those arguments. It is going to look for a constructor in the super class that takes those 3 constructors. Did you supply a constructor like that?

    For the second error. You are calling a method, it should have () at the end.
    Java Code:
    super.getInventoryValue()
    
    not 
    
    super.getInventoryValue
    Last edited by sunde887; 04-19-2011 at 04:11 AM.

  3. #3
    Raven9 is offline Member
    Join Date
    Apr 2011
    Posts
    8
    Rep Power
    0

    Default

    I got those 2 error corrected, now have the following error:

    C:\Documents and Settings\AdminUser\My Documents\InventoryPart3.java:92: invalid method declaration; return type required
    public Television(int ItemNumber, String ProductName, int UnitsStock, double UnitPrice, String mfgName) {
    ^
    1 error

    Tool completed with exit code 1

  4. #4
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    11

    Default

    Show the changed code please. Remember, constructors take the same name as the class.

  5. #5
    Raven9 is offline Member
    Join Date
    Apr 2011
    Posts
    8
    Rep Power
    0

    Default

    C:\Documents and Settings\AdminUser\My Documents\InventoryPart3.java:93: cannot find symbol
    symbol : constructor Television(int,java.lang.String,int,double)
    location: class Television
    super(ItemNumber, ProductName, UnitsStock, UnitPrice);
    ^
    1 error

    Tool completed with exit code 1


    Java Code:
    class Television { //class name and attributes
    
    	private String ItemNumber; //item # of product
    	private String ProductName; //product name
    	public double UnitsStock; //# of units in stock
    	public double UnitPrice; //Price per unit
    	private String SerialNumber; //serial number of product
    	private double InventoryValue; //The dollar value of the inventory in stock
    
    	//constructor
    
        public Television (String item, String product, double units, double price, String serial) {
    		ItemNumber = item;
    		ProductName = product;
    		UnitsStock = units;
    		UnitPrice = price;
    		SerialNumber = serial;
    
    } //end constructor
    
    ///getter and setter methods for Television
    
    	public void setItemNumber (String item) { //setter for item number
    		this.ItemNumber = item;
    	} //end setter item number
    
    	public String getItemNumber() { //getter for item number
    		return ItemNumber;
    	} //end getter item number
    
    	public void setProductName (String product) { //setter for product name
    		this.ProductName = product;
    	} //end setter product name
    
    	public String getProductName() { //getter for product name
    		return ProductName;
    	} //end getter product name
    
    	public void setUnitsStock (double units) { //setter for units in stock
    		this.UnitsStock = units;
    	} //end setter units in stock
    
    	public double getUnitsStock() { //getter for units in stock
    		return UnitsStock;
    	} //end getter units in stock
    
    	public void setUnitPrice (double price) { //setter for unit price
    		this.UnitPrice = price;
    	} //end setter unit price
    
    	public double getUnitPrice() { //getter for unit price
    		return UnitPrice;
    	} //end getter for unit price
    
    	public void setSerialNumber (String serial) { //setter for serial number
    		this.SerialNumber = serial;
    	}//end setter for serial number
    
    	public String getSerialNumber() { //getter for serial number
    		return SerialNumber;
    	}//end getter for serial number
    
    
    
    	//calculate individual product inventory value
    
    	public double getInventoryValue(){
    		return UnitsStock * UnitPrice;
    
    	}//end calculate individual product inventory value
    
    
    	//calculate total inventory value
    	public double calculateInventory(){
    		return UnitPrice * UnitsStock;
    	}//end calculate total inventory value
    
    ///end getter and setter methods for Laptop
    
    } //end class Television
    
      class Manufacturer extends Television {
    	private String manufacturerName;
    
    	//constructor
    
    	public Manufacturer(int ItemNumber, String ProductName, int UnitsStock, double UnitPrice, String mfgName) {
    		super(ItemNumber, ProductName, UnitsStock, UnitPrice);
    
    		this.manufacturerName = mfgName;
    
    	}//end constructor
    
    	//getter and setter for class Manufacturer
    
    	public void setmanufacturerName(String mfgName) {
    		this.manufacturerName = mfgName;
    	}
    
    	public String getmanufacturerName() {
    		return manufacturerName;
    	}
    
    	//end getter and setter for class Manufacturer
    
    	//calculate total inventory value
    
    	public double calculateInventory(){
    		return ((UnitPrice * UnitsStock));
    
    	}//end calculate total inventory value
    
    	//calculate restocking fee method
    
    	public double getcalculateRestockFee() {
    		return super.getInventoryValue();
    
    	}//end calculate restocking fee method
    
    }//end class Manufacturer

  6. #6
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,807
    Rep Power
    10

    Default

    Quote Originally Posted by Raven9 View Post
    C:\Documents and Settings\AdminUser\My Documents\InventoryPart3.java:93: cannot find symbol
    symbol : constructor Television(int,java.lang.String,int,double)
    location: class Television
    super(ItemNumber, ProductName, UnitsStock, UnitPrice);
    ^
    1 error

    Tool completed with exit code 1

    This is the original error which you claim was fixed. You are still trying to call a constructor that does not exist. The order, type and number of parameters must match.

  7. #7
    Raven9 is offline Member
    Join Date
    Apr 2011
    Posts
    8
    Rep Power
    0

    Default

    I made corrections to the other errors, then this one came back. I am not sure exactly how to fix this problem. This is all new to me and trying to grasp this the best I can.

  8. #8
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,807
    Rep Power
    10

    Default

    It is easy to fix. Just like you have been told numerous times you have tio make sure the parameters match: order, type, number
    Java Code:
    public void methodOne(String s, int i) { }
    
    public void methodTwo(int x) {}
    
    public void methodThree(String a, String b, String c) { }
    
    public void doStuff() {
        methodOne(7, "hello"); // error order is wrong
    
        methodTwo("hello"); // error type is wrong
    
        methodThree("hello", "world"); // error number is wrong
    }

  9. #9
    Raven9 is offline Member
    Join Date
    Apr 2011
    Posts
    8
    Rep Power
    0

    Default

    Thank you for all your help. I had to stop and slow down, think as you pointed out. I appreciate your patience, helpful advise. You guys are the best!!!!

Similar Threads

  1. Replies: 3
    Last Post: 04-18-2011, 11:33 PM
  2. [SOLVED] error messages
    By raghu9198 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 12-10-2008, 07:21 AM
  3. All JSP expert / Is there JSP code for calling & sending messages? please help me
    By java student in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 12-02-2008, 11:51 AM
  4. Error Messages Not Showing Up
    By nvidia in forum Web Frameworks
    Replies: 0
    Last Post: 04-07-2008, 10:41 PM
  5. Jsf Error Messages - Retain
    By vaswin in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 08-05-2007, 08:22 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •