I have asked my instructor to help me with this error so I can move on to the next part of the program which is due Sunday, but no help to give I guess my problem is that when i try to compile my program I get a class, interface,enum expected error on lines 217 and 218.
import javax.swing.*;
import java.awt.event.*;
my code is posted all help will be greatly appreciated.

public class Inventory
{

	public static void main(String args[])
	{
		Cameras[] Cameras = new Cameras[4];

		// objects call class
		Cameras [0] = new Cameras( 0, "Nikon D300", "Electronics", 2, 429.00 );
		Cameras [1] = new Cameras( 1, "Canon Power Shot", "Electronics", 4, 139.00 );
		Cameras [2] = new Cameras( 2, "Kodak EasyShare", "Electronics", 6, 135.00 );
		Cameras [3] = new Cameras( 3, "Nikon Coolpix", "Electronics", 1, 199.00 );
		
		// outputs product

		for (int i = 0; i < 4; i++) 
		{
		  System.out.println( "Item number: " + Cameras[i].getitemnumber() );
		  System.out.println( "Camera name: " + Cameras[i].getCameras() );
		  System.out.println( "Department: " + Cameras[i].getdepartment() );
		  System.out.println( "Units in stock: " + Cameras[i].getinstock() );
		  System.out.println( "Price: $" + Cameras[i].getprice() );
		  System.out.println( "Total value: $" + Cameras[i].inv_value() );
		  System.out.println();
		}

		DigitalCameras[] DigitalCameras = new DigitalCameras[2];

		DigitalCameras [0] = new DigitalCameras( 0, "Nikon Digital", "Electronics", 8, 

2, 529.00 );
		DigitalCameras [1] = new DigitalCameras( 1, "Canon Digital", "Electronics", 

10, 4, 639.00 );

		for (int i = 0; i < 2; i++) 
		{
		  System.out.println( "Item number: " + DigitalCameras[i].getitemnumber() );
		  System.out.println( "Camera name: " + DigitalCameras[i].getDigitalCameras() 

);
		  System.out.println( "Department: " + DigitalCameras[i].getdepartment() );
		  System.out.println( "Resolution: " + DigitalCameras[i].getimageResolution() 

);
		  System.out.println( "Units in stock: " + DigitalCameras[i].getinstock() );
		  System.out.println( "Price: $" + DigitalCameras[i].getprice() );
		  System.out.println( "Total value: $" + DigitalCameras[i].inv_value() );
		  System.out.println();

		}	
	}
}// End class

class Cameras
 {
	private String Cameras;
	private String department;
	private float itemnumber;
	private float instock;
	private double price;

	   public Cameras()
	{
	   Cameras = " Cameras ";
	   department = " Electronics ";
	   itemnumber = 0;
	   instock = 0;
	   price = 0;
	} 

	public Cameras( float itemnumber, String Cameras, String department, float instock, 

double price )
	{
	   this.itemnumber = itemnumber;
	   this.Cameras = Cameras;
	   this.department = department;
	   this.instock = instock;
	   this.price = price;
	}

	public void setitemnumber( float itemnumber )
	{
	this.itemnumber = itemnumber;
	}
	public float getitemnumber()
	{
	return itemnumber;
	}
	public void setCameras( String Cameras )
	{
	this.Cameras = Cameras;
	}
	String getCameras()
	{
	return Cameras;
	}
	public void setdepartment( String department )
	{
	this.department = department;
	}
	String getdepartment()
	{
	return department;
	}
	public void setinstock( float instock )
	{
	this.instock = instock;
	}
	public float getinstock()
	{
	return instock;
	}
	public void setprice( double price )
	{
	this.price = price;
	}
	public double getprice()
	{
	return price;
	}
	public double inv_value()
	{
	return ( instock * price );
	}
    
	
 }// end class

class DigitalCameras extends Cameras
{
	private String DigitalCameras;
	private String department;
	private float itemnumber;
	private float imageResolution;
	private float instock;
	private double price;

	   public DigitalCameras()
	{
	   DigitalCameras = " DigitalCameras ";
	   department = " Electronics ";
	   itemnumber = 0;
	   imageResolution = 0;
	   instock = 0;
	   price = 0;
	}

 	public DigitalCameras( float itemnumber, String DigitalCameras, String department, 

float imageResolution, float instock, double price )
	{
	   this.itemnumber = itemnumber;
	   this.DigitalCameras = DigitalCameras;
	   this.department = department;
	   this.imageResolution = imageResolution;
	   this.instock = instock;
	   this.price = price;
	}

	public void setitemnumber( float itemnumber )
	{
	this.itemnumber = itemnumber;
	}
	public float getitemnumber()
	{
	return itemnumber;
	}
	public void setDigitalCameras( String DigitalCameras )
	{
	this.DigitalCameras = DigitalCameras;
	}
	String getDigitalCameras()
	{
	return DigitalCameras;
	}
	public void setdepartment( String department )
	{
	this.department = department;
	}
	String getdepartment()
	{
	return department;
	}
	public void setimageResolution( float imageResolution )
	{
	this.imageResolution = imageResolution;
	}
	public float getimageResolution()
	{
	return imageResolution;
	}
	public void setinstock( float instock )
	{
	this.instock = instock;
	}
	public float getinstock()
	{
	return instock;
	}
	public void setprice( double price )
	{
	this.price = price;
	}
	public double getprice()
	{
	return price;
	}
	public double inv_value()
	{
	return ( instock * price + price * 0.05 );
	}
		
}// end class

import javax.swing.*;
import java.awt.event.*;

//Stores and gets Camera info
class Inventory_Gui extends JFrame 
{
	private JTextArea txt;
	private Inventory inv;
	private int currentDisplay = 0;
	
	public Inventory_Gui() 
	{
		super("Cameras");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // quit if the window is 

closed
		init();
	}
	public void init() {
		// Incorprate feed back from instructor
		DigitalCameras p1 = new DigitalCameras( 0, "Digi Fast", "Electronics", 6, 3, 

199.00 );
		DigitalCameras p2 = new DigitalCameras( 1, "Aqua Clear Digital", 

"Electronics", 4, 1, 180.00 );

		// Create inventory add objects
		inv = new Inventory();
		inv.add(p1);
		inv.add(p2);
		
		inv.sort();

		// output the 

		
		for (int i = 0; i < 2; i++) 
		{
		  System.out.println( "Item number: " + DigitalCameras[i].getitemnumber() );
		  System.out.println( "Camera name: " + DigitalCameras[i].getDigitalCameras() 

);
		  System.out.println( "Department: " + DigitalCameras[i].getdepartment() );
		  System.out.println( "Resolution: " + DigitalCameras[i].getimageResolution() 

);
		  System.out.println( "Units in stock: " + DigitalCameras[i].getinstock() );
		  System.out.println( "Price: $" + DigitalCameras[i].getprice() );
		  System.out.println( "Total value: $" + DigitalCameras[i].inv_value() );
		  System.out.println();
		}

		System.out.println("Total value: $" + String.format("%.2f",inv.value()));
		
		// set interface
		JPanel panel = new JPanel();
		txt = new JTextArea(15,40);
		txt.setEditable(false);
		panel.add(txt);
		
		JButton next = new JButton("Next");
		next.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if (currentDisplay < inv.size()-1) currentDisplay++; //advance 

to the end
				displayCameras();
			}
		});
		panel.add(next);
		
		getContentPane().add(panel);
		
		displayCameras();
	}
	
	// view software
	public void displayCameras() {
		txt.setText( "Details" );
		txt.append( "Item number: " + inv.get(currentDisplay).getItem() );
		txt.append( "Camera name: " + inv.get(currentDisplay).getName() );
		txt.append( "Department: " + inv.get(currentDisplay).getdepartment() );
		txt.append( "Resolution: " + inv.get(currentDisplay).getimageResolution() );
		txt.append( "Units in stock: " + inv.get(currentDisplay).getinstock() );
		txt.append( "Price: $" + String.format("%.2f",inv.get

(currentDisplay).getprice()) );
		txt.append( "Total value: $" + String.format("%.2f",inv.get

(currentDisplay).inv_value()) );
	
		txt.append( "Total value: $" + String.format("%.2f",inv_value()) );

	}
	
	public static void main(String args[]) {
		Inventory gui = new Inventory();
		gui.pack();
		gui.setVisible(true);
	}
//		
}

I just hope you actually split it in appropriate classes Inventory, Cameras, DigitalCameras and Inventory_Gui and not tried to compile and run it as one class or you would look really foolish...

I just hope you actually split it in appropriate classes Inventory, Cameras, DigitalCameras and Inventory_Gui and not tried to compile and run it as one class or you would look really foolish...

Well guess I am foolish because I Thought I had split the code in to classes. The code work before I added this section. Or is it that I did not split that section in to classes.

Once you split code into 4 classes there are 3 errors on compile of Inventory_Gui to do with commented text actually on uncommented line (It could be also because of copy and paste here) then on next compile there is 22 errors to do with things not being implemented in classes or mistyped

When you split the code into classes you ended up with "import" statements in the middle of your file. That's illegal, they must be the first thing in the file (except for a "package" statement).
So either you just put the imports at the beginning and leave all your classes in 1 file, or you split the classes into different files, each with their own imports.
How many files is up to you, except that any class declared "public" must be in a file with the same name as the class - hence every public class must be in its own file. Non-public classes can go where it suits you, according to your package design.

@JamesCherrill you need to split on 4 classes then imports are in right place ;)

Yes, sure, that's a good solution. As there's only 1 public class the single file solution is also valid. I only posted because it wasn't clear to me that the O/P had understood why his original lines 217/218 were invalid.

Yes, sure, that's a good solution. As there's only 1 public class the single file solution is also valid. I only posted because it wasn't clear to me that the O/P had understood why his original lines 217/218 were invalid.

Thank you both for your post I never did get it and at this point Im starting to have a break down so I am thinking it is over for me in this class which sucks cause I made it this far.

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.