473,554 Members | 3,184 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to design an Inventory Program GUI

8 New Member
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 6978
SammyB
807 Recognized Expert Contributor
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 New Member
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 MVP
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
4621
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 proposing a single column table with a field name called vehicle_type and this will contain the vehicle type. Sot it will be
11
2444
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 as stock control system where I need to keep track of the quantities of products. Our company is a retail chain, and we have eight shops or...
109
25730
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 assignments... 4. CheckPoint: Inventory Program Part 1 • Resource: Java: How to Program • Due Date: Day 5 forum • Choose a product that lends...
0
7099
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 the due date 10% of the grade is taken off. I think I'm coming down with the flu and my brain is just not processing this assignment. Here is the...
9
7597
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 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...
2
2507
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 the corresponding actions on the item name, the number of units in stock, and the price of each unit. An item added to the inventory should have an...
1
2654
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 that uses one additional unique feature of the product you chose (for the DVDs subclass, you could use movie title, for example). In the subclass,...
3
4464
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 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...
2
4429
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 reading has very little in it that helps can someone take a look at this code and point me in the right direction please. Thanks for any help that is...
0
7516
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7787
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8029
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7551
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7881
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5428
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5147
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3539
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
831
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.