473,386 Members | 1,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to design an Inventory Program GUI

8
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.

Expand|Select|Wrap|Line Numbers
  1. class Inventory { //Begin Inventory Class
  2.  
  3.     String Number; //stores Item number
  4.     String ItemName; //stores Item Name
  5.     int Quantity; //stores quanity
  6.     double Price; //stores price
  7.     double RestockFee; //stores restocking fee
  8.  
  9.     public Inventory(String Item_Number, String Item_Name, int Stocked_Items, double Item_Price, double Item_Fee)
  10.     {
  11.         Number = Item_Number;
  12.         ItemName = Item_Name;
  13.         Quantity = Stocked_Items;
  14.         Price = Item_Price;
  15.         RestockFee = Item_Fee;
  16.     }
  17.  
  18.  
  19.     public void setItemItemName(String Item_Name) //Method to set and get the item Item Name
  20.  
  21.     {
  22.         ItemName = Item_Name;
  23.  
  24.     }
  25.  
  26.     public String getItemItemName()
  27.  
  28.     {
  29.         return ItemName;
  30.  
  31.     }
  32.  
  33.     public void setNumber(String Item_Number) //Method to set and get the Item Number
  34.  
  35.     {
  36.         Number = Item_Number;
  37.  
  38.     }
  39.  
  40.     public String getNumber()
  41.  
  42.     {
  43.         return Number;
  44.  
  45.     }
  46.  
  47.     public void setItemsInStock(int Stocked_Items) //Method to set and get the quantity in stock
  48.  
  49.     {
  50.         Quantity = Stocked_Items;
  51.  
  52.     }
  53.  
  54.     public int getItemsInStock()
  55.  
  56.     {
  57.         return Quantity;
  58.  
  59.     }
  60.  
  61.     public void setItemPrice(double Item_Price) //Method to set and get the Item Price
  62.  
  63.     {
  64.  
  65.         Price = Item_Price;
  66.  
  67.     }
  68.  
  69.     public double getItemPrice()
  70.  
  71.     {
  72.  
  73.         return Price;
  74.  
  75.     }
  76.  
  77.  
  78.     public void setItemFee(double Item_Fee) //Method to set and get the restocking fee
  79.  
  80.     {
  81.         RestockFee = Item_Fee;
  82.  
  83.     }
  84.  
  85.     public double getItemFee()
  86.  
  87.     {
  88.  
  89.         return RestockFee;
  90.  
  91.     }
  92.  
  93.  
  94.     public double getInventoryValue() //Method to calculate the value of the inventory in stock
  95.  
  96.     {
  97.  
  98.         return Price * Quantity;
  99.  
  100.     }
  101.  
  102.  
  103.     public static double getTotalValueOfAllInventory(Inventory [] inv)
  104.  
  105.     {
  106.         double tot = 0.0;
  107.  
  108.         for(int i = 0; i < inv.length; i++)
  109.         {
  110.         tot += inv[i].getInventoryValue();
  111.         }
  112.         return tot;
  113.     }
  114.  
  115.  
  116.     public String toString()
  117.     {
  118.     return "Manufacutre: "+ItemName + "\nItem Number: "+Number+"\nItem Price: $"+Price+"\nQuantity in Stock: "+Quantity + "\nRestocking Fee: $"+RestockFee + "\nInventory Value: $"+getInventoryValue();
  119.  
  120.     }
  121.  
  122. } // end Inventory Class
  123.  
  124.  
  125. //============================================================================================//
  126.  
  127. class PC extends Inventory { // Begin PC Class
  128.  
  129.     String Workstation;                    // Subclass to add to PC
  130.     double reRestockFee;                // Add Restock Fee to Inventory Value
  131.  
  132.  
  133.         public PC(String Workstation, double reRestockFee, String Item_Number, String Item_Name, int Stocked_Items,
  134.         double Item_Price, double Item_Fee) {
  135.         super(Item_Number, Item_Name, Stocked_Items, Item_Price, Item_Fee);
  136.         this.Workstation = Workstation;
  137.         this.reRestockFee = reRestockFee;
  138.     }
  139.  
  140.     public double getInventoryValue() // Figures total inventory value including restocking fee
  141.     {
  142.         return  super.getInventoryValue() + (super.getInventoryValue() * reRestockFee);
  143.     }
  144.  
  145.     public String toString()
  146.     {
  147.         StringBuffer sb = new StringBuffer("\nWorkstation: ").append(Workstation).append("\n");
  148.         sb.append(super.toString());
  149.  
  150.         return sb.toString();
  151.     }
  152.  
  153. } // End PC Class
  154.  
  155.  
  156. //============================================================================================//
  157.  
  158. class Inventory4 // Begin Inventorypart4 Class
  159.  
  160. {
  161.     public static void main(String args[])
  162.     {
  163.  
  164.         double restockFee = 0.05;
  165.  
  166.         PC[] inventory = new PC[8]; //create array of PC 
  167.  
  168.         inventory[0] = new PC("Dell 4200" ,restockFee, "100","Dell" , 7, 799.00, 39.95);  
  169.         inventory[1] = new PC("Dell 4400" ,restockFee, "101","Dell" , 6,  899.00, 44.95 ); 
  170.         inventory[2] = new PC("Dell 4600",restockFee, "102","Dell", 5,  1199.00, 59.95);  
  171.         inventory[3] = new PC("Dell 5600",restockFee,"103","Dell" , 3, 1299.00, 64.95);     
  172.         inventory[4] = new PC("HP 8700",restockFee,"200","HP" , 2, 1599.00, 79.95);    
  173.         inventory[5] = new PC("HP 8800",restockFee,"201","HP" , 10, 2299.00, 114.95); 
  174.         inventory[6] = new PC("HP 9400",restockFee,"202","HP" , 6, 2500.00, 125); 
  175.         inventory[7] = new PC("HP 9600",restockFee,"203","HP" , 1, 2999.00, 149.95); 
  176.  
  177.  
  178.         PC temp[] = new PC[1];
  179.  
  180.          System.out.print( "Inventory of Workstations: " ); // display title
  181.             System.out.println();
  182.             System.out.println();
  183.  
  184.  
  185.  
  186. // Sorting Inventory Information
  187.         for(int j = 0; j < inventory.length - 1; j++)
  188.         {
  189.             for(int k = 0; k < inventory.length - 1; k++)
  190.             {
  191.                 if(inventory[k].getItemItemName().compareToIgnoreCase(inventory[k+1].getItemItemName()) > 0)
  192.                 {
  193.                     temp[0] = inventory[k];
  194.                     inventory[k] = inventory[k+1];
  195.                     inventory[k+1] = temp[0];
  196.                 }
  197.             }
  198.         }
  199.  
  200.  
  201. // Print Inventory Information
  202.         for(int j = 0; j < inventory.length; j++)
  203.         {
  204.             System.out.println(inventory[j].toString());
  205.         }
  206.  
  207.  
  208.         System.out.printf("\n\nTotal value of Workstation Inventory: $%.2f\n\n" , Inventory.getTotalValueOfAllInventory(inventory));
  209.         return;
  210.  
  211.     }
  212. } // End Inventory4 Class
  213.  
Nov 12 '07 #1
3 6953
SammyB
807 Expert 512MB
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?
Nov 13 '07 #2
cblank
8
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,
Nov 20 '07 #3
r035198x
13,262 8TB
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.
Nov 20 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

36
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, plane, tractor etc etc For the table design I am...
11
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 for the company that I work for. It's basically...
109
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 compile to at least get a few points... Here are the...
0
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 assignment was due yesterday and each day I go past...
9
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 the information one product at a time, including...
2
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 GUI. These buttons should allow the user to perform...
1
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 Program by creating a subclass of the product class...
3
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 product, the number of units in stock, the price...
2
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. The assignment requirements are listed but the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.