here is my TestInvoice class (i have no idea what im doing for it):
import javax.swing.JOptionPane;
public class TestInvoice
{
public static void main(String[] args)
{
Invoice shoes = new Invoice();
String itemNumber, name, quantity, price;
itemNumber = JOptionPane.showInputDialog(null, "Please Enter the Item Number");
name = JOptionPane.showInputDialog(null, "Please Enter the Item Name");
quantity = JOptionPane.showInputDialog(null, "Please Enter the Quantity");
price = JOptionPane.showInputDialog(null, "Please Enter the Price");
JOptionPane.showMessageDialog(null, "Your Invoice: " + "\n" +
"Item Number: " + itemNumber + "\n" +
"Item Name: " + name + "\n" +
"Quantity: " + quantity + "\n" +
"Price of Item: " + price + "\n");
}
{
Invoice fruit = new Invoice();
String itemNumber, name, quantity, price;
itemNumber = JOptionPane.showInputDialog(null, "Please Enter the Item Number");
name = JOptionPane.showInputDialog(null, "Please Enter the Item Name");
quantity = JOptionPane.showInputDialog(null, "Please Enter the Quantity");
price = JOptionPane.showInputDialog(null, "Please Enter the Price");
JOptionPane.showMessageDialog(null, "Your Invoice: " + "\n" +
"Item Number: " + itemNumber + "\n" +
"Item Name: " + name + "\n" +
"Quantity: " + quantity + "\n" +
"Price of Item: " + price + "\n");
}
{
Invoice bread = new Invoice();
String itemNumber, name, quantity, price;
itemNumber = JOptionPane.showInputDialog(null, "Please Enter the Item Number");
name = JOptionPane.showInputDialog(null, "Please Enter the Item Name");
quantity = JOptionPane.showInputDialog(null, "Please Enter the Quantity");
price = JOptionPane.showInputDialog(null, "Please Enter the Price");
JOptionPane.showMessageDialog(null, "Your Invoice: " + "\n" +
"Item Number: " + itemNumber + "\n" +
"Item Name: " + name + "\n" +
"Quantity: " + quantity + "\n" +
"Price of Item: " + price + "\n");
}
}
_____
her notes back from the testinvoice are as follows:
Your input statements are fine, but you never call the set methods of the class to get the values into the class. When you put them into the class your set methods will auto calculate total price. The you have a displayLine method that will display everything.
TestInvoice needs to
1) declare variables for itemNumber. name, quantity, price, and 3 objects of the Invoice type.
2) instantiate the 3 objects using the new keyword
3) get values for the 1st invoice then call the set methods of the Invoice class
4) get values for the 2nd invoice then call the set methods on the Invoice class
5) get values for the 3rd invoice then call the set methods of the Invoice class
6) call the displayLine method of the Invoice class 3 times, once for each invoice object