Im trying to create a GUI which would 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, restocking fee, and the value of the inventory of that product. Any advice or help
Here is my code:
import java.util.Scanner;
import java.util.Arrays;
public class InventoryProgramPart3
{
// main method begins program execution
public static void main(String args[] )
{
// create Scanner to obtain input from command window
Scanner input = new Scanner( System.in );
// display a welcome message to the InventoryProgramPart3 user
System.out.println( "Welcome to Inventory Program Part 3!" );
// office softwares
softwares[] softwares = new softwares[100]; // an array of 100 supplies
softwares buisness = new softwares( 4000, "Microsoft Office 2007", 60, 120.75 );
softwares security = new softwares( 5000, "Norton Internet Security 2009", 75, 75.00 );
softwares games = new softwares( 2000, "World of Warcraft Pc Game", 30, 66.00 );
softwares os1 = new softwares( 1000, "Windows Vista", 15, 245.25 );
softwares os2 = new softwares( 3000, "Windows XP", 45, 175.50 );
// display the inventories one at a time
os1.showInventory();
games.showInventory();
os2.showInventory();
buisness.showInventory();
security.showInventory();
// sort softwares by name
for ( int i = 0; i < args.length; i++ )
System.out.println( args + ", " );
double array[] = { 78.75, 142.50, 157.50, 165.00, 93.75 };
double total = 0;
// add each element's value to total
for ( int counter = 0; counter < array.length; counter++)
total += array[ counter ];
System.out.printf( "\nTotal inventory value is: $%.2f\n", total );
System.out.println( "\nThank you for using Inventory Program Part 3!\n" );
} // end method main
} // end class InventoryProgramPart3
// Office Softwares
class softwares
{
public int softwareNumber;
public String softwareName = new String();
public int softwareUnits;
public double softwarePrice;
// set software number
public void setSoftwareNumber( int number )
{
this.softwareNumber = number;
} // end method set softwares number
// return software number
public int getSoftwareNumber()
{
return softwareNumber;
} // end method get softwares number
// set softwares name
public void setSoftwaresName( String name )
{
this.softwareName = name;
} // end method set softwares name
// return softwares name
public String getSoftwaresName()
{
return softwareName;
} // end method get softwares name
// set softwares in stock
public void setSoftwaresUnits( int units )
{
this.softwareUnits = units;
} // end method set softwares units
// return softwares units
public int getSoftwaresUnits()
{
return softwareUnits;
} // end method get softwares units
// set Softwares price
public void setSoftwaresPrice( double price )
{
this.softwarePrice = price;
} // end method set softwares price
// return softwares price
public double getSoftwaresPrice()
{
return softwarePrice;
} // end method get softwares price
// calculate softwares inventory value
public double getValue()
{
return softwareUnits * softwarePrice;
} // end method softwares inventory value
// four-argument constructor
softwares(int number,String name,int units,double price )
{
softwareNumber = number;
softwareName = name;
softwareUnits = units;
softwarePrice = price;
} // end four-argument constructor
// display inventory
public void showInventory()
{
System.out.println(); // outputs blank line
System.out.println( "Product Number: "+softwareNumber );
System.out.println( "Product Name: "+softwareName );
System.out.println( "Number of Units: "+softwareUnits );
System.out.printf( "Unit Price: $%.2f",+softwarePrice );
// value() method and display the value
System.out.printf( "\nInventory value of "+softwareName+ " is = $%.2f\n",
getValue() );
} // end display inventory
} // end class softwares
class manufacturer extends softwares
{
// holds the softwares manufacturer
private String softwaresManufacturer;
/

