6 Replies - 585 Views - Last Post: 16 July 2008 - 05:40 PM Rate Topic: -----

#1 maximus32  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 01-July 08

Help with inventory program

Post icon  Posted 14 July 2008 - 10:12 AM

So far this is my completed inventory program, which has a few errors, I was hoping someone can look over my program and help me fix my errors. I was able to complete the array portion of this program, can some just look it over for me and let me know if its okay.

As for the last part of this program I am getting a ton of errors regarding the super class portion. Here are the errors im getting..

Any help will be highly appreciated.

Thanks in advance

ERRORS:

deps-jar:
Compiling 1 source file to C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\build\classes
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:157: '{' expected
class Main2
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:159: <identifier> expected
public main2 {
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: illegal start of type
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: ';' expected
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: illegal start of type
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: ';' expected
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: <identifier> expected
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: <identifier> expected
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: <identifier> expected
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: <identifier> expected
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: <identifier> expected
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: <identifier> expected
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: <identifier> expected
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: <identifier> expected
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: <identifier> expected
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: <identifier> expected
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: <identifier> expected
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:230: <identifier> expected
public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:231: <identifier> expected
int dvdyear);





package inventoryprogram;


public class inventoryprogram {

	public static void main(String[] args) {
   
// MY DVD CLASS	   
class DVD 
  { 
		private String DVDNAME; //DVD NAME
		private double DVDNUMBER;//DVD NUMBER
		private double DVDUNITS;//DVD UNITS
		private double DVDCOST;//DVD UNITS
		private double INVENTORYVALUE; // INVENTORYVALUE of DVDUNITS * DVDCOST 

	// Display DVDNAME, DVDNUMBER,DVDUNITS,DVDCOSTS & INVENTORYVALUE
	public DVD(String DVDNAME, double DVDNUMBER, double DVDUNITS, double DVDCOST, double INVENTORYVALUE) 
	{		
			this.DVDNAME = DVDNAME;
			this.DVDNUMBER = DVDNUMBER;
			this.DVDUNITS = DVDUNITS;
			this.DVDCOST = DVDCOST;
			this.INVENTORYVALUE = INVENTORYVALUE;
	}

	DVD(String string, int i, int i0, double d) {
		throw new UnsupportedOperationException("Not yet implemented");
	}

		public double getDVDCOST() {
			return DVDCOST;
		}
		public void setDVDCOST(double DVDCOST) {
			this.DVDCOST = DVDCOST;
		}
		public String getDVDNAME() {
			return DVDNAME;
		}
		public void setDVDNAME(String DVDNAME) {
			this.DVDNAME = DVDNAME;
		}
		public double getDVDNUMBER() {
			return DVDNUMBER;
		}
		public void setDVDNUMBER(double DVDNUMBER) {
			this.DVDNUMBER = DVDNUMBER;
		}
		public double getDVDUNITS() {
			return DVDUNITS;
		}
		public void setDVDUNITS(double DVDUNITS) {
			this.DVDUNITS = DVDUNITS;
		}
		public double getINVENTORYVALUE() {
			return INVENTORYVALUE;
		}
		public void setINVENTORYVALUE(double INVENTORYVALUE) {
			this.INVENTORYVALUE = INVENTORYVALUE;
		}  
		
		 // Calculation of the value of the inventory
		public double getinventoryvaluee(){
			return (DVDCOST *(double)DVDUNITS);
		}

	  

	
}
	class DVD2 {

		private String DVDName = null;
		private int DVDNumber = 0;
		private int DVDUNITS = 0;
		private double DVDCOST = 0;
		private double DVDINVENTORYVALUE = 0;
		private double TOTALINVENTORY = 0;

		public DVD2(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY) {
			this.DVDName = DVDName;
			this.DVDNumber = DVDNumber;
			this.DVDUNITS = DVDUNITS;
			this.DVDCOST = DVDcost;
			this.DVDINVENTORYVALUE = DVDINVENTORYVALUE;
			this.TOTALINVENTORY = TOTALINVENTORY;
		}

		DVD2(String string, int i, int i0, double d) {
			throw new UnsupportedOperationException("Not yet implemented");
		}

		public String getDVDName() {
			return DVDName;
		}

		public void setDVDName(String DVDName) {
			this.DVDName = DVDName;
		}

		public int getDVDNumber() {
			return DVDNumber;
		}

		public void setDVDNumber(int DVDNumber) {
			this.DVDNumber = DVDNumber;
		}

		public int getDVDUNITS() {
			return DVDUNITS;
		}

		public void setDVDUNITS(int DVDUNITS) {
			this.DVDUNITS = DVDUNITS;
		}

		public double getDVDCOST() {
			return DVDCOST;
		}

		public void setDVDCOST(double DVDCOST) {
			this.DVDCOST = DVDCOST;
		}

		public double getDVDINVENTORYVALUE() {
			return DVDINVENTORYVALUE;
		}

		public void setDVDINVENTORYVALUE(double DVDINVENTORYVALUE) {
			this.DVDINVENTORYVALUE = DVDINVENTORYVALUE;
		}

		public double getTOTALINVENTORY() {
			return TOTALINVENTORY;
		}

		public void setTOTALINVENTORY(double TOTALINVENTORY) {
			this.TOTALINVENTORY = TOTALINVENTORY;
		}
	} // End of Class DVD
		
	

		// Inventory program part 3
	  class Main2 
		  
	   public main2 {
		 private int x;
		 
		public void Main(String[] args) {
		
			
			DVD Inventory[];//My Array
			Inventory = new DVD[5];// Size of my Array
			
			String[]dvdname = {"Transformers", "Superman", "Wanted", "Get Smart", "300"};
			int[] dvdnumber = {001, 002, 003, 004, 005};
			int[] dvdunits = {5, 6, 7, 8,9};
			double[]dvdcost = {5.00, 6.00, 7.00, 8.00, 9.00};
			
			 // Creating info for my Array	  
			Inventory[0] = new DVD("Transformers", 001, 5, 5.00);
			Inventory[0] = new DVD("Superman", 002, 6, 6.00);
			Inventory[0] = new DVD("Wanted", 003, 7, 7.00);
			Inventory[0] = new DVD("Get Smart", 004, 8, 8.00);
			Inventory[0] = new DVD("300", 005, 9, 900);
			
			Inventory[1] = new DVD("Transformers", 001, 5, 5.00);
			Inventory[1] = new DVD("Superman", 002, 6, 6.00);
			Inventory[1] = new DVD("Wanted", 003, 7, 7.00);
			Inventory[1] = new DVD("Get Smart", 004, 8, 8.00);
			Inventory[1] = new DVD("300", 005, 9, 900);
			
			Inventory[2] = new DVD("Transformers", 001, 5, 5.00);
			Inventory[2]= new DVD("Superman", 002, 6, 6.00);
			Inventory[3] = new DVD("Wanted", 003, 7, 7.00);
			Inventory[3] = new DVD("Get Smart", 004, 8, 8.00);
			Inventory[3] = new DVD("300", 005, 9, 900);
			
			Inventory[4] = new DVD("Transformers", 001, 5, 5.00);
			Inventory[4] = new DVD("Superman", 002, 6, 6.00);
			Inventory[4] = new DVD("Wanted", 003, 7, 7.00);
			Inventory[4] = new DVD("Get Smart", 004, 8, 8.00);
			Inventory[4] = new DVD("300", 005, 9, 900);
			
			System.out.println("dvdname: " + dvdname[1]);
			System.out.println("dvdnumber: " + dvdnumber[1]);
			System.out.println("dvdunits: " + dvdnumber[1]);
			System.out.println("dvdcost: " + dvdnumber[1]);		 
				
			  
			   // adding a product to array	 
		 for (int x = 0; x < dvdname.length; x++);{
			  System.out.println("DVD " +(x+0) + ": " + dvdname[x]);
		 for (int x = 0; x < dvdnumber.length; x++);{
			  System.out.println("DVD " +(x+1) + ": " + dvdnumber[x]);
		 for (int x = 0; x < dvdunits.length; x++);{
			  System.out.println("DVD " +(x+2) + ": " + dvdunits[x]);
		 for (int x = 0; x < dvdcost.length; x++);{
			  System.out.println("DVD " +(x+3) + ": " + dvdcost[x]);
		 for (int x = 0; x < dvdcost.length; x++);{
			  System.out.println("DVD " +(x+4) + ": " + dvdcost[x]);
		}
	   } 
	  }
	 }
	}
   }

  }
	  
  class DVD extends DVD {
	  // Assigning the year the movie was done.
		private int dvdyear;
		private int year;
	 
	  // CONSTRUCTOR
	   public super class(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY,
			   int dvdyear);
		
	   {  // calls to superclass DVDINVENTORY   
	   super(DVDName, DVDNumber, DVDUNITS, DVDCOST, INVENTORYVALUE);
	   dvdyear = year; // storing and validating my dvd year addition  
	   }	  
	   
		 public int getdvdyear(){
			return dvdyear;
		 }   
		 // Adding 5% restock fee
		public double getInventoryvalue(){
			return super.getInventoryvalue() * 2.00;
		}   
		 // 5% restock fee only	
		 public double getRestockfee(){
			return super.getInventoryvalue() * .05;	
		 }
		}
	  }
	}


This post has been edited by maximus32: 14 July 2008 - 01:23 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Help with inventory program

#2 Programmist  Icon User is offline

  • CTO
  • member icon

Reputation: 252
  • View blog
  • Posts: 1,833
  • Joined: 02-January 06

Re: Help with inventory program

Posted 14 July 2008 - 01:51 PM

The very first error message you pasted tells you exactly what the problem is and exactly where in your code it is. Look more closely.

The very first error message you pasted tells you exactly what the problem is and exactly where in your code it is. Look more closely.
Was This Post Helpful? 0
  • +
  • -

#3 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8342
  • View blog
  • Posts: 31,885
  • Joined: 06-March 08

Re: Help with inventory program

Posted 14 July 2008 - 03:58 PM

public class inventoryprogram {

	public static void main(String[] args) {
   
// MY DVD CLASS	   
class DVD 
  { 



Sure that if you close "}" your main() method it will help
Was This Post Helpful? 0
  • +
  • -

#4 maximus32  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 01-July 08

Re: Help with inventory program

Posted 16 July 2008 - 09:30 AM

I really appreciate all the help and advice you have giving me so far so I've now made the necessary changes to my program and I am getting new errors on the array portion. I need to add a product to the array but its giving me these errors below. I am really not sure what I am doing wrong. Help please. :-)

My updated code is below - Thanks again in advance.

These are my errors:

Compiling 1 source file to C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\build\classes
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:201: cannot find symbol
symbol : variable length
location: class inventoryprogram.dvdinventory
for (int x = 0; x < dvdinventory.length; x++);{
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:203: cannot find symbol
symbol : variable length
location: class inventoryprogram.dvdinventory
for (int x = 0; x < dvdinventory.length; x++);{
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:205: cannot find symbol
symbol : variable length
location: class inventoryprogram.dvdinventory
for (int x = 0; x < dvdinventory.length; x++);{
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:207: cannot find symbol
symbol : variable length
location: class inventoryprogram.dvdinventory
for (int x = 0; x < dvdinventory.length; x++);{
C:\WINNT\Profiles\ukph1a\My Documents\NetBeansProjects\inventoryprogram\src\inventoryprogram\inventoryprogram.java:209: cannot find symbol
symbol : variable length
location: class inventoryprogram.dvdinventory
for (int x = 0; x < dvdinventory.length; x++);{
5 errors


package inventoryprogram;


public class inventoryprogram {

	public static void main(String[] args) {
   
// MY DVD CLASS	   
	class DVD 
   { 
		private String dvdname; //DVD NAME
		private double dvdnumber;//DVD NUMBER
		private double dvdunits;//DVD UNITS
		private double dvdcost;//DVD UNITS
		private double inventoryvalue; // INVENTORYVALUE of DVDUNITS * DVDCOST 

	// Display DVDNAME, DVDNUMBER,DVDUNITS,DVDCOSTS & INVENTORYVALUE
	public DVD(String dvdname, double dvdnumber, double dvdunits, double dvdcost, double inventoryvalue) {
				this.dvdname = dvdname;
				this.dvdnumber = dvdnumber;
				this.dvdunits = dvdunits;
				this.dvdcost = dvdcost;
				this.inventoryvalue = inventoryvalue;
			}		  

	DVD(String string, int i, int i0, double d) {
		throw new UnsupportedOperationException("Not yet implemented");
	}

			public double getDvdcost() {
				return dvdcost;
			}

			public void setDvdcost(double dvdcost) {
				this.dvdcost = dvdcost;
			}

			public String getDvdname() {
				return dvdname;
			}

			public void setDvdname(String dvdname) {
				this.dvdname = dvdname;
			}

			public double getDvdnumber() {
				return dvdnumber;
			}

			public void setDvdnumber(double dvdnumber) {
				this.dvdnumber = dvdnumber;
			}

			public double getDvdunits() {
				return dvdunits;
			}

			public void setDvdunits(double dvdunits) {
				this.dvdunits = dvdunits;
			}

			public double getinventoryvalue() {
				return inventoryvalue;
			}

			public void setinventoryvalue(double inventoryvalue) {
				this.inventoryvalue = inventoryvalue;
			}
	
	 
		   // Calculation of the value of the inventory
			public double getinventoryvaluee(){
			  return (dvdcost *(double)dvdunits);
		}
	}

	class DVD2 {

		private String DVDName = null;
		private int DVDNumber = 0;
		private int DVDUNITS = 0;
		private double DVDCOST = 0;
		private double DVDINVENTORYVALUE = 0;
		private double TOTALINVENTORY = 0;

		public DVD2(String DVDName, int DVDNumber, int DVDUNITS, double DVDcost, double DVDINVENTORYVALUE, double TOTALINVENTORY) {
			this.DVDName = DVDName;
			this.DVDNumber = DVDNumber;
			this.DVDUNITS = DVDUNITS;
			this.DVDCOST = DVDcost;
			this.DVDINVENTORYVALUE = DVDINVENTORYVALUE;
			this.TOTALINVENTORY = TOTALINVENTORY;
		}

		DVD2(String string, int i, int i0, double d) {
			throw new UnsupportedOperationException("Not yet implemented");
		}

		public String getDVDName() {
			return DVDName;
		}

		public void setDVDName(String DVDName) {
			this.DVDName = DVDName;
		}

		public int getDVDNumber() {
			return DVDNumber;
		}

		public void setDVDNumber(int DVDNumber) {
			this.DVDNumber = DVDNumber;
		}

		public int getDVDUNITS() {
			return DVDUNITS;
		}

		public void setDVDUNITS(int DVDUNITS) {
			this.DVDUNITS = DVDUNITS;
		}

		public double getDVDCOST() {
			return DVDCOST;
		}

		public void setDVDCOST(double DVDCOST) {
			this.DVDCOST = DVDCOST;
		}

		public double getDVDINVENTORYVALUE() {
			return DVDINVENTORYVALUE;
		}

		public void setDVDINVENTORYVALUE(double DVDINVENTORYVALUE) {
			this.DVDINVENTORYVALUE = DVDINVENTORYVALUE;
		}

		public double getTOTALINVENTORY() {
			return TOTALINVENTORY;
		}

		public void setTOTALINVENTORY(double TOTALINVENTORY) {
			this.TOTALINVENTORY = TOTALINVENTORY;
		}
	} // End of Class DVD
		
	

		// Inventory program part 3
	  class Main2 {
		  
		  private int x;
	   
		 
		public void Main(String[] args) {
		
			
			DVD Inventory[];//My Array
			Inventory = new DVD[5];// Size of my Array
			
			String[]dvdname = {"Transformers", "Superman", "Wanted", "Get Smart", "300"};
			int[] dvdnumber = {001, 002, 003, 004, 005};
			int[] dvdunits = {5, 6, 7, 8,9};
			double[]dvdcost = {5.00, 6.00, 7.00, 8.00, 9.00};
			
			 // Creating info for my Array	  
			Inventory[0] = new DVD("Transformers", 001, 5, 5.00);
			Inventory[0] = new DVD("Superman", 002, 6, 6.00);
			Inventory[0] = new DVD("Wanted", 003, 7, 7.00);
			Inventory[0] = new DVD("Get Smart", 004, 8, 8.00);
			Inventory[0] = new DVD("300", 005, 9, 900);
			
			Inventory[1] = new DVD("Transformers", 001, 5, 5.00);
			Inventory[1] = new DVD("Superman", 002, 6, 6.00);
			Inventory[1] = new DVD("Wanted", 003, 7, 7.00);
			Inventory[1] = new DVD("Get Smart", 004, 8, 8.00);
			Inventory[1] = new DVD("300", 005, 9, 900);
			
			Inventory[2] = new DVD("Transformers", 001, 5, 5.00);
			Inventory[2]= new DVD("Superman", 002, 6, 6.00);
			Inventory[3] = new DVD("Wanted", 003, 7, 7.00);
			Inventory[3] = new DVD("Get Smart", 004, 8, 8.00);
			Inventory[3] = new DVD("300", 005, 9, 900);
			
			Inventory[4] = new DVD("Transformers", 001, 5, 5.00);
			Inventory[4] = new DVD("Superman", 002, 6, 6.00);
			Inventory[4] = new DVD("Wanted", 003, 7, 7.00);
			Inventory[4] = new DVD("Get Smart", 004, 8, 8.00);
			Inventory[4] = new DVD("300", 005, 9, 900);
			
			System.out.println("dvdname: " + dvdname[1]);
			System.out.println("dvdnumber: " + dvdnumber[1]);
			System.out.println("dvdunits: " + dvdnumber[1]);
			System.out.println("dvdcost: " + dvdnumber[1]);		 
				
				 
			   // adding a product to array	 
		 for (int x = 0; x < dvdinventory.length; x++);{
			  System.out.println("DVD " +(x+0) + ": " + dvdname[x]);
		 for (int x = 0; x < dvdinventory.length; x++);{
			  System.out.println("DVD " +(x+1) + ": " + dvdnumber[x]);
		 for (int x = 0; x < dvdinventory.length; x++);{
			  System.out.println("DVD " +(x+2) + ": " + dvdunits[x]);
		 for (int x = 0; x < dvdinventory.length; x++);{
			  System.out.println("DVD " +(x+3) + ": " + dvdcost[x]);
		 for (int x = 0; x < dvdinventory.length; x++);{
			  System.out.println("DVD " +(x+4) + ": " + dvdcost[x]);
		}
	   } 
	  }
	 }
	}
   }
  }
	  
  class DVD3 extends DVD {
	  // Assigning the year the movie was done.
		int dvdyear;
		int year;

		// calls to superclass DVDINVENTORY
		public DVD3(String DVDNAME, double DVDNUMBER, double DVDUNITS, double DVDCOST, double INVENTORYVALUE, int year) {
				super(DVDNAME, DVDNUMBER, DVDUNITS, DVDCOST, INVENTORYVALUE);
				this.year = year;// storing and validating my dvd year addition  
			}
		   
		 public int getdvdyear(){
			return dvdyear;
		 }   
		 // Adding 5% restock fee
		public double getinventoryvalue(){
			return super.getinventoryvalue() * 2.00;
		}   
		 // 5% restock fee only	
		 public double getRestockfee(){
			return super.getinventoryvalue() * .05;	
		 }
	   }
	}
}


Was This Post Helpful? 0
  • +
  • -

#5 Onker  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 51
  • Joined: 15-July 08

Re: Help with inventory program

Posted 16 July 2008 - 11:53 AM

You have "dvdinventory.length" in your for loop. Have you tried it with "inventory.length" instead?


Though I think a better way to handle it would be to increment a count, and then call that as the limit for the for loop. Otherwise, if your array was actually a size of 10, and you had 5 values...you'd end up with a Nullpointerexception.

I didn't see an increaseSize method either, it was one of the things I learned the hard way...always build one in. That's where your need for a count comes in really necessary too.

Hope that helps a bit.
Was This Post Helpful? 0
  • +
  • -

#6 maximus32  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 01-July 08

Re: Help with inventory program

Posted 16 July 2008 - 12:26 PM

Thank Onker for the help, I was able to get it tocompile. Now i can finally move on to the GUI portion of the assingment.

Hopefully i can understand the next step, if not I'll be back..

Thanks again for the help
Was This Post Helpful? 0
  • +
  • -

#7 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8342
  • View blog
  • Posts: 31,885
  • Joined: 06-March 08

Re: Help with inventory program

Posted 16 July 2008 - 05:40 PM

the variable dvdinventory does not exist
neither dvdinvory.length

you probably mean Inventory.lenght which will return the length of the array of DVD named Inventory
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1