I need help fixing these errors. Thanks
C:\Users\Michael\Desktop\java6\GUI3.java:268: cannot find symbol
symbol : method getInventory1Test(int)
location: class GUI3
Inventory1Test temp = (Inventory1Test) GUI3
.getInventory1Test(index);
^
C:\Users\Michael\Desktop\java6\GUI3.java:269: cannot find symbol
symbol : method getitem()
location: class Inventory1
int item = Inventory1
.getitem() +1;
^
C:\Users\Michael\Desktop\java6\GUI3.java:269: operator + cannot be applied to Inventory1.getitem,int
int item = Inventory1.getitem
() +1;
^
C:\Users\Michael\Desktop\java6\GUI3.java:269: incompatible types
found : <nulltype>
required: int
int item = Inventory1.getitem()
+1;
^
C:\Users\Michael\Desktop\java6\GUI3.java:282: cannot find symbol
symbol : constructor Inventory1(java.lang.String,int,int,double,java.lang.String)
location: class Inventory1
Inventory1 inventory =
new Inventory1( "Add Movie", Integer.parseInt(jtfNumber.getText()) + 1, 0, 0.0, "Add Rating");
^
C:\Users\Michael\Desktop\java6\GUI3.java:284: cannot find symbol
symbol : method addInventory1(Inventory1)
location: class GUI3
myGUI3
.addInventory1(inventory );
^
C:\Users\Michael\Desktop\java6\GUI3.java:289: cannot find symbol
symbol : method removeInventory1(Inventory1Test)
location: class GUI3
myGUI3
.removeInventory1(temp);
^
C:\Users\Michael\Desktop\java6\GUI3.java:332: cannot find symbol
symbol : method getInventory1(int)
location: class GUI3
Inventory1 modify = (Inventory1) myGUI3
.getInventory1(index);
^
C:\Users\Michael\Desktop\java6\GUI3.java:338: cannot find symbol
symbol : method setRate(java.lang.String)
location: class Inventory1
modify
.setRate(rate);
CODE
import javax.swing.JOptionPane;
import java.awt.FlowLayout; // specifies how components are arranged
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame; // provides basic window features
import javax.swing.JLabel; // displays text and images
import javax.swing.SwingConstants;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.JPanel;
import javax.swing.Box;
public class GUI3 extends JFrame implements ActionListener
{
private GUI3 myGUI3;
private JLabel label2; // JLabel Item number
private JLabel label3; // JLabel Title of Movie
private JLabel label4; // JLabel Movie Rating
private JLabel label5; // JLabel Stock Number
private JLabel label6; // JLabel Number of Item in Stock
private JLabel label7; // JLabel Restocking Fee
private JLabel label8; // JLabel Purchase Price
private JLabel label9; // JLabel Inventory Value
private JLabel label10; // JLabel Total Inventory Value
private JTextField jtfItem;
private JTextField jtfVideo; //1
private JTextField jtfRating; //2
private JTextField jtfNumber; //3
private JTextField jtfStock;//4
private JTextField jtfReStock; //5 getrestock()
private JTextField jtfPrice; //6
private JTextField jtfValue; //7 getresult()
private JTextField jtftotalInv;//8
private JLabel label11; //JLabel icon
private JButton btnFirst;
private JButton btnPrevious;
private JButton btnNext;
private JButton btnLast;
private JButton btnAdd;
private JButton btnDelete;
private JButton btnModify;
private JButton btnSave;
private JButton btnSearch;
private JButton btnLoadfile;
DVD[] dvd;
int index = 0;
// LabelFrame constructor adds JLabels to JFrame
public GUI3()
{
super( "Inventory of DVD Movies" );
// JLabel constructor with a string argument
//this.inventory1 = inventory1;
JLabel jl;
JPanel jp;
setLayout( new FlowLayout() ); // set frame layout
label2 = new JLabel("Item#: " );
label2.setHorizontalTextPosition( SwingConstants.LEFT );
label2.setVerticalTextPosition( SwingConstants.TOP );
jtfItem = new JTextField (10);
jtfItem.setEditable(false);
add( label2 ); // add label2 to JFrame
add(jtfItem);
label3 = new JLabel( "Title of Movie: ");
label3.setHorizontalTextPosition( SwingConstants.RIGHT );
label3.setVerticalTextPosition( SwingConstants.CENTER );
jtfVideo = new JTextField (30);
jtfVideo.setEditable(true);
add( label3 ); // add label2 to JFrame
add(jtfVideo);
label4 = new JLabel("Movie Rating:");
label4.setHorizontalTextPosition( SwingConstants.LEFT );
label4.setVerticalTextPosition( SwingConstants.TOP );
jtfRating = new JTextField (5);
jtfRating.setEditable(true);
add( label4 ); // add label2 to JFrame
add(jtfRating);
label5 = new JLabel("Item Number:");
label5.setHorizontalTextPosition( SwingConstants.LEFT );
label5.setVerticalTextPosition( SwingConstants.TOP );
jtfNumber = new JTextField (20);
jtfNumber.setEditable(true);
add( label5 ); // add label2 to JFrame
add(jtfNumber);
label6 = new JLabel( "# of Items in Stock:");
label6.setHorizontalTextPosition( SwingConstants.LEFT );
label6.setVerticalTextPosition( SwingConstants.TOP );
jtfStock = new JTextField (10);
jtfStock.setEditable(true);
add( label6 ); // add label2 to JFrame
add(jtfStock);
label7 = new JLabel( "Restocking Fee:" );
label7.setHorizontalTextPosition( SwingConstants.LEFT );
label7.setVerticalTextPosition( SwingConstants.TOP );
jtfReStock = new JTextField (10);
jtfReStock.setEditable(false);
add( label7 ); // add label2 to JFrame
add(jtfReStock);
label8 = new JLabel( "Purchase Price:");
label8.setHorizontalTextPosition( SwingConstants.LEFT );
label8.setVerticalTextPosition( SwingConstants.TOP );
jtfPrice = new JTextField (10);
jtfPrice.setEditable(true);
add( label8 ); // add label2 to JFrame
add(jtfPrice);
label9 = new JLabel( "Inventory Value:");
label9.setHorizontalTextPosition( SwingConstants.LEFT );
label9.setVerticalTextPosition( SwingConstants.TOP );
jtfValue = new JTextField (10);
jtfValue.setEditable(false);
add( label9 ); // add label2 to JFrame
add(jtfValue);
label10 = new JLabel( "Total Inventory Value:\n");
label10.setHorizontalTextPosition( SwingConstants.LEFT );
label10.setVerticalTextPosition( SwingConstants.TOP );
jtftotalInv = new JTextField (10);
jtftotalInv.setEditable(false);
add( label10 ); // add label2 to JFrame
add(jtftotalInv);
Icon dvd = new ImageIcon(getClass().getResource( "dvd.jpg" ));
label11 = new JLabel ( dvd, SwingConstants.LEFT);
label11.setVerticalTextPosition( SwingConstants.TOP);
add( label11 );
btnFirst = new JButton( "First" );
btnFirst.addActionListener(this);
add( btnFirst );
btnPrevious = new JButton( "Previous" );
btnPrevious.addActionListener(this);
add( btnPrevious );
btnNext = new JButton( "Next" );
btnNext.addActionListener(this);
add( btnNext );
btnLast = new JButton( "Last" );
btnLast.addActionListener(this);
add( btnLast );
btnAdd = new JButton( "Add" );
btnAdd.addActionListener(this);
add( btnAdd );
btnDelete = new JButton( "Delete" );
btnDelete.addActionListener(this);
add( btnDelete );
btnModify = new JButton( "Modify" );
btnModify.addActionListener(this);
add( btnModify );
btnSave = new JButton( "Save" );
btnSave.addActionListener(this);
add( btnSave );
btnSearch = new JButton( "Search" );
btnSearch.addActionListener(this);
add( btnSearch );
btnLoadfile = new JButton( "Load file" );
btnLoadfile.addActionListener(this);
add( btnLoadfile );
setSize(800,500);
setVisible(true);
} // end LabelFrame constructor
void setDVD(DVD[] dvd)
{
this.dvd = dvd;
index = 0;
}
void display() {
jtfItem.setText("" + dvd[index].getItems());
jtfVideo.setText("" + dvd[index].getVideo());
jtfRating.setText("" + dvd[index].getRating());
jtfNumber.setText("" + dvd[index].getNumber());
jtfStock.setText("" + dvd[index].getStock());
jtfReStock.setText("" + dvd[index].getRestockingFee());
jtfPrice.setText("" + dvd[index].getPrice());
jtfValue.setText("" + dvd[index].getValue());
jtftotalInv.setText("" + dvd[index].CalculateTotalInventoryValue(dvd));
}
// to display next movie
void displayFirst(){
index = 0;
display();
}
void displayNext() {
index++;
if(index >= dvd.length ) // wrap around
index = 0;
display();
}
// display previous
void displayPrevious() {
index--;
if(index < 0) // wrap around
index = dvd.length - 1;
display();
}
void displayLast(){
index = dvd.length - 1;
display();
}
public void actionPerformed(ActionEvent e){
Object buttonPressed = e.getSource();
if(buttonPressed == btnFirst){
index = 0;
displayFirst();
return;
}
if (buttonPressed == btnNext) {
displayNext();
return;
}
if (buttonPressed == btnPrevious){
displayPrevious();
return;
}
if (buttonPressed == btnLast){
displayLast();
return;
}
if(buttonPressed == btnAdd)
{
Inventory1Test temp = (Inventory1Test) GUI3.getInventory1Test(index);
int item = Inventory1.getitem() +1;
index = (item - 2) % item;
display();
if(jtfVideo.getText().equals("Add Movie" )) // catches for assigning more then one blank at a time
{
JOptionPane.showMessageDialog(null, "Please fill out the blank entry you already have before adding more\nRemember: Push Modify when you finish with your changes","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
}
if(jtfVideo.getText().equals("Add Movie" ) !=true) // allows the adding of an entry
{
Inventory1 inventory = new Inventory1( "Add Movie", Integer.parseInt(jtfNumber.getText()) + 1, 0, 0.0, "Add Rating");
index = (index - 1) % index;
myGUI3.addInventory1(inventory );
display();
}
if (index == 29) // catches for going over static inventory size
{
myGUI3.removeInventory1(temp);
JOptionPane.showMessageDialog(null, "Please No More Entries\n You can increase my capacity in the java file CdInvApp.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
}
}// end action
if(buttonPressed == btnModify)
{
if (jtfVideo.getText().equals("")) //traps for blank entry
{
JOptionPane.showMessageDialog(null, "Please Complete the Entry.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
display();
}
if (jtfRating.getText().equals("")) //traps for blank entry
{
JOptionPane.showMessageDialog(null, "Please Complete the Entry.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
display();
}
try // traps for letters and blank entry
{
Integer.parseInt(jtfStock.getText());
Double.parseDouble(jtfPrice.getText());
}
catch (Exception d)
{
JOptionPane.showMessageDialog(null, "Recheck Entry use numbers for price and quantity.","Negative GhostRider the pattern is full", JOptionPane.ERROR_MESSAGE);
display();
}
String name; String rate; int number; int stock; double price; // declares variables
name = jtfVideo.getText();
rate = jtfRating.getText();
number = Integer.parseInt(jtfNumber.getText());
stock = Integer.parseInt(jtfStock.getText());
price = Double.parseDouble(jtfPrice.getText());
Inventory1 modify = (Inventory1) myGUI3.getInventory1(index);
modify.setNumber(number);
modify.setVideo(name);
modify.setStock(stock);
modify.setPrice(price);
modify.setRate(rate);
display();
} // end class
}//
} // end class GUI
CODE
import java.lang.String;
import java.text.DecimalFormat;
import java.awt.FlowLayout; // specifies how components are arranged
import javax.swing.JFrame; // provides basic window features
import javax.swing.JLabel; // displays text and images
import javax.swing.JTextField;
public class Inventory1Test
{
static DecimalFormat formatter = new DecimalFormat("$##,###.00");
public static void main( String args[] )
{
DVD[] library = new DVD[4];
library[0] = new DVD( "1", "Star Wars", "PG", 232, 5, 13.45);
library[1] = new DVD("2", "Cars", "G", 233, 7, 12.23 );
library[2] = new DVD("3", "Fantastic Four", "PG", 234, 8, 18.45);
library[3] = new DVD("4", "Batman", "PG-13", 235, 2, 10.88);
GUI3 gui3 = new GUI3();
gui3.setDVD(library);
Double totalInv = library[0].CalculateTotalInventoryValue(library);
//Double restockingFee = library[index].getRestockingFee();
//System.out.printf( "Restocking Fee(5%): \t%s\n\n", library[index].getRestockingFee());
}//end main
}//end class Inventory1Test
CODE
//inventory part 1
import java.lang.String;
public class Inventory1
{
protected String items;
protected String video;
protected int number;
protected int stock;
protected double price;
protected double value;
public Inventory1( String i, String v, int n, int s, double p )
{
setItems(i);
setVideo(v);
setNumber(n);
setStock(s);
setPrice(p);
}//end Inventory1 five-argument constructor
public Inventory1( Inventory1 inventory)
{
this( inventory.getItems(), inventory.getVideo(), inventory.getNumber(), inventory.getStock(), inventory.getPrice() );
}//end Inventoryconstructor with a Inventory object argument
public void setInventory1( String i, String v, int n, int s, double p )
{
setItems( i );
setVideo( v );
setNumber( n );
setStock( s );
setPrice( p );
}//end method setInventory
public void setItems( String i )
{
items = ( i );
}//end method setItems
public void setVideo( String v )
{
video = ( v );
}//end method setVideo
public void setNumber( int n )
{
number = ( n );
}//end method setNumber
public void setStock( int s )
{
stock = ( s );
}//end method setStock
public void setPrice(double p )
{
price = ( p );
}//end method setPrice
public String getItems()
{
return items;
}//end method getItems
public String getVideo()
{
return video;
}//end method getVideo
public int getNumber()
{
return number;
}//end method getNumber
public int getStock()
{
return stock;
}//end method getStock
public double getPrice()
{
return price;
}//end method getPrice
public double getValue()
{
return (stock * price);
}//end method getValue
public Double CalculateTotalInventoryValue(Inventory1[] product)
{
Double total = 0.0;
for(int index = 0; index < product.length; index++)
{
Inventory1 inv = product[index];
total += inv.getValue();
}
return total;
}
public Inventory1[] SortInventory1 (Inventory1[] theInventory1)
{
Inventory1 tmp;
for (int index = 0; index < theInventory1.length; index++)
{
for (int anotherindex = index + 1; anotherindex< theInventory1.length; anotherindex++)
{
String s1 = theInventory1[index].getVideo();
String s2 = theInventory1[anotherindex].getVideo();
if( s1.compareTo(s2) > 0)
{
tmp = theInventory1[index];
theInventory1 [index] = theInventory1[anotherindex];
theInventory1 [anotherindex] = tmp;
}
}
}
return theInventory1;
}
}//end class Inventory1
CODE
public class DVD extends Inventory1 {
// Holds the rating of the movie
private String movierating;
private String items;
private String video;
private int number;
private int stock;
private double price;
private double value;
public DVD( String items, String video, String rating, int number, int stock, double price )
{
super( items, video, number, stock, price );
movierating = rating;
}
public String getRating() {
return movierating;
}
// Simply gets the base class's value, and figures out the 5% restocking fee only
public double getRestockingFee() {
// return super.getValue() * .05;
return getPrice()*0.05;
}
public double getValue()
{
return(getPrice()*getStock()*1.05);
}//end method getValue
}//end class DVD
^