Submitted by: Submitted by to1269
Views: 1187
Words: 5121
Pages: 21
Category: Science and Technology
Date Submitted: 12/17/2010 03:55 PM
Instructions: This document contains the tutorials for Inventory programs 4-6. These programs will be separated by a blank page between each program, as well as color coded.
NOTE: This information will need to be copy and pasted into a notepad document. Please do not plagiarize my work, make it your own. This document is not to be copied.
// Inventory program part 4 Inventory4.java
//
// Uses a GUI to display the information one product at a time
// GUI also displays the value of the entire inventory, the product brand name, and the restocking fee
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.FlowLayout;
import java.awt.BorderLayout;
import java.awt.GridLayout;
class Inventory {
String number; //stores product number
String name; //stores product name
int quantity; //stores quanity in stock
double price; //stores product price
public Inventory(String Num, String N, int Q, double P)
{
number = Num;
name = N;
quantity = Q;
price = P;
}
public void setName(String N) //Method to set and get the product name
{
name = N;
}
public String getName()
{
return name;
}
public void setNumber(String Num) //Method to set and get the product number
{
number = Num;
}
public String getNumber()
{
return number;
}
public void setQuantity(int Q) //Method to set and get the quantity in stock
{
quantity = Q;
}
public int getQuantity()
{
return quantity;
}
public void setPrice(double P) //Method to set and get the price
{
price = P;
}
public double getPrice()
{
return price;
}
public double getInventoryValue() //Method to calculate the value of the in stock inventory
{
return price * quantity;
}
public String toString()
{
return "Product Name: "+name + "\nProduct Number: "+number+"\nProduct Price: $"+price+"\nQuantity in Stock: "+quantity + "\nInventory Value:...