I need some help if someone could help me. I know everyone is asking for help in java. But for some reason I'm the same as everyone else when it comes to programming in java. I have an inventory program that I have built so far with no problem. But I cannot figure out how to turn it into a GUI application.
This is what I'm trying to get it to do.
Modify the Inventory Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. In addition, the GUI should display the value of the entire inventory, the additional attribute, and the restocking fee. -
class Inventory { //Begin Inventory Class
-
-
String Number; //stores Item number
-
String ItemName; //stores Item Name
-
int Quantity; //stores quanity
-
double Price; //stores price
-
double RestockFee; //stores restocking fee
-
-
public Inventory(String Item_Number, String Item_Name, int Stocked_Items, double Item_Price, double Item_Fee)
-
{
-
Number = Item_Number;
-
ItemName = Item_Name;
-
Quantity = Stocked_Items;
-
Price = Item_Price;
-
RestockFee = Item_Fee;
-
}
-
-
-
public void setItemItemName(String Item_Name) //Method to set and get the item Item Name
-
-
{
-
ItemName = Item_Name;
-
-
}
-
-
public String getItemItemName()
-
-
{
-
return ItemName;
-
-
}
-
-
public void setNumber(String Item_Number) //Method to set and get the Item Number
-
-
{
-
Number = Item_Number;
-
-
}
-
-
public String getNumber()
-
-
{
-
return Number;
-
-
}
-
-
public void setItemsInStock(int Stocked_Items) //Method to set and get the quantity in stock
-
-
{
-
Quantity = Stocked_Items;
-
-
}
-
-
public int getItemsInStock()
-
-
{
-
return Quantity;
-
-
}
-
-
public void setItemPrice(double Item_Price) //Method to set and get the Item Price
-
-
{
-
-
Price = Item_Price;
-
-
}
-
-
public double getItemPrice()
-
-
{
-
-
return Price;
-
-
}
-
-
-
public void setItemFee(double Item_Fee) //Method to set and get the restocking fee
-
-
{
-
RestockFee = Item_Fee;
-
-
}
-
-
public double getItemFee()
-
-
{
-
-
return RestockFee;
-
-
}
-
-
-
public double getInventoryValue() //Method to calculate the value of the inventory in stock
-
-
{
-
-
return Price * Quantity;
-
-
}
-
-
-
public static double getTotalValueOfAllInventory(Inventory [] inv)
-
-
{
-
double tot = 0.0;
-
-
for(int i = 0; i < inv.length; i++)
-
{
-
tot += inv[i].getInventoryValue();
-
}
-
return tot;
-
}
-
-
-
public String toString()
-
{
-
return "Manufacutre: "+ItemName + "\nItem Number: "+Number+"\nItem Price: $"+Price+"\nQuantity in Stock: "+Quantity + "\nRestocking Fee: $"+RestockFee + "\nInventory Value: $"+getInventoryValue();
-
-
}
-
-
} // end Inventory Class
-
-
-
//============================================================================================//
-
-
class PC extends Inventory { // Begin PC Class
-
-
String Workstation; // Subclass to add to PC
-
double reRestockFee; // Add Restock Fee to Inventory Value
-
-
-
public PC(String Workstation, double reRestockFee, String Item_Number, String Item_Name, int Stocked_Items,
-
double Item_Price, double Item_Fee) {
-
super(Item_Number, Item_Name, Stocked_Items, Item_Price, Item_Fee);
-
this.Workstation = Workstation;
-
this.reRestockFee = reRestockFee;
-
}
-
-
public double getInventoryValue() // Figures total inventory value including restocking fee
-
{
-
return super.getInventoryValue() + (super.getInventoryValue() * reRestockFee);
-
}
-
-
public String toString()
-
{
-
StringBuffer sb = new StringBuffer("\nWorkstation: ").append(Workstation).append("\n");
-
sb.append(super.toString());
-
-
return sb.toString();
-
}
-
-
} // End PC Class
-
-
-
//============================================================================================//
-
-
class Inventory4 // Begin Inventorypart4 Class
-
-
{
-
public static void main(String args[])
-
{
-
-
double restockFee = 0.05;
-
-
PC[] inventory = new PC[8]; //create array of PC
-
-
inventory[0] = new PC("Dell 4200" ,restockFee, "100","Dell" , 7, 799.00, 39.95);
-
inventory[1] = new PC("Dell 4400" ,restockFee, "101","Dell" , 6, 899.00, 44.95 );
-
inventory[2] = new PC("Dell 4600",restockFee, "102","Dell", 5, 1199.00, 59.95);
-
inventory[3] = new PC("Dell 5600",restockFee,"103","Dell" , 3, 1299.00, 64.95);
-
inventory[4] = new PC("HP 8700",restockFee,"200","HP" , 2, 1599.00, 79.95);
-
inventory[5] = new PC("HP 8800",restockFee,"201","HP" , 10, 2299.00, 114.95);
-
inventory[6] = new PC("HP 9400",restockFee,"202","HP" , 6, 2500.00, 125);
-
inventory[7] = new PC("HP 9600",restockFee,"203","HP" , 1, 2999.00, 149.95);
-
-
-
PC temp[] = new PC[1];
-
-
System.out.print( "Inventory of Workstations: " ); // display title
-
System.out.println();
-
System.out.println();
-
-
-
-
// Sorting Inventory Information
-
for(int j = 0; j < inventory.length - 1; j++)
-
{
-
for(int k = 0; k < inventory.length - 1; k++)
-
{
-
if(inventory[k].getItemItemName().compareToIgnoreCase(inventory[k+1].getItemItemName()) > 0)
-
{
-
temp[0] = inventory[k];
-
inventory[k] = inventory[k+1];
-
inventory[k+1] = temp[0];
-
}
-
}
-
}
-
-
-
// Print Inventory Information
-
for(int j = 0; j < inventory.length; j++)
-
{
-
System.out.println(inventory[j].toString());
-
}
-
-
-
System.out.printf("\n\nTotal value of Workstation Inventory: $%.2f\n\n" , Inventory.getTotalValueOfAllInventory(inventory));
-
return;
-
-
}
-
} // End Inventory4 Class
-
3 6834
You need to answer the following questions:
1) What type of GUI am I going to design? Swing, Applet, JFrame, or ?
2) What controls do I need to add?
You need to answer the following questions:
1) What type of GUI am I going to design? Swing, Applet, JFrame, or ?
2) What controls do I need to add?
The gui program will be built using Swing. I have tried to program using the JAVA gui before, but I am not having any luck. I really dont know were to start. I have done ok up until now. Right now I just need The application to use a GUI to display the product information of one product, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product.The GUI displays the additional attribute from the subclass, the restocking fee, and the value of the entire inventory.
Thanks,
The gui program will be built using Swing. I have tried to program using the JAVA gui before, but I am not having any luck. I really dont know were to start. I have done ok up until now. Right now I just need The application to use a GUI to display the product information of one product, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product.The GUI displays the additional attribute from the subclass, the restocking fee, and the value of the entire inventory.
Thanks,
Here's Sun's swing tutorial.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: toedipper |
last post by:
Hello,
I am designing a table of vehicle types, nothing special, just a list of
unique vehicle types such as truck, lorry, bike, motor bike,...
|
by: Michael Thomas |
last post by:
Hi everyone
Not sure if this is the right newsgroup to be posting to for this question,
but I am using Access 2002 to develop a database solution...
|
by: zaidalin79 |
last post by:
I have a java class that goes for another week or so, and I am going to fail if I can't figure out this simple program. I can't get anything to...
|
by: south622 |
last post by:
I'm taking a beginning Java course and I'm stuck in week eight of a nine week course. If anyone could help me I would greatly appreciate it. This...
|
by: xxplod |
last post by:
I am suppose to modify the Inventory Program so the application can handle multiple items. Use an array to store the items. The output should display...
|
by: pinkf24 |
last post by:
I cannot figure out how to add the following:
Modify the Inventory Program to include an Add button, a Delete button, and a Modify button on the...
|
by: jcato77 |
last post by:
I need help with a class project I'm working on, Below is my assignment and the code I have currently created.
Assignment:
Modify the Inventory...
|
by: 100grand |
last post by:
Modify the Inventory Program to use a GUI. The GUI should display the information one
product at a time, including the item number, the name of the...
|
by: blitz1989 |
last post by:
Hello all, I'm new to this forum and Java and having a alot of problems understanding this language. I am working on an invetory program part 4. ...
|
by: concettolabs |
last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
|
by: better678 |
last post by:
Question:
Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct?
Answer:
Java is an object-oriented...
|
by: teenabhardwaj |
last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
| |