This program requires 4 class programs and a main driver that brings it all together.
Iam currently working on the first 2 and have many errors. The first two classes are:
Retail Item Class
Write a class named RetailItem that holds data about an item in a retail store. The class should have the following fields:
description – The description fields references a String object that holds a brief description of the item.
unitsOnHand – The unitsOnHand field is an int variable that holds the number of units currently in inventory.
price – The price field is a double that holds the item's retail price.
Store Inventory Class
Write a StoreInventory class that creates an object that holds all the items in a store's inventory. The StoreInventory class should provide for storage of RetailItem objects that constitute a store's stock inventory. The StoreInventory class should have the following methods:
The addToInventory method should take a RetailItem object and add it to the store's inventory.
The getTotalPriceOfInventory method should return the total amount of retail dollars that the entire inventory represents.
The getUnitsOnHand method should return an integer value of the number of units on hand of an item.
Sales Transaction Class
Write a SalesTransaction class that creates a sales receipt as a result of point of sale operation. The SalesTransaction class should have the following methods:
The createSalesReceipt method will create a sales receipt from the currentTransaction object which contains quantities, descriptions and totals for each item purchased.
The sales receipt should look like the following:
Store xyz Sales Receipt
Quantity Description Totals
1 Jacket @ $59.95 each $59.95
2 Shirt @ $24.95 each $49.90
Subtotal: $109.85
Sales Tax: $4.67
Total: $114.52
Point Of Sale Class
Write a PointOfSale class that can be used with the classes that you wrote above. The PointOfSale class should simulate a retail sales transaction. The class should have the following methods:
The showItemInventory method should display the contents of the store's inventory and display an index number representing each item. That number will be used by the sales clerk to "ring up" an item. Items with 0 units on hand should not be displayed.
The enterItemAndQuantity method should accept an index number from the showItemInventory listing and an integer representing the number of items to be purchased, and create a soldItem object.
The getSubtotal method should return the subtotal of the sale, which is the quantity multiplied by the price. This method must get the price from the RetailItem object that was retrieved from the StoreInventory object.
The getTax method should return the amount of sales tax on the purchase. The sales tax is 4.25% of a retail sale.
The getTotal method should return the total of the sale, which is the subtotal plus the sales tax.
Demonstrate the classes written above in a program that asks the user to choose one or more separate items from the description of the RetailItems, specifies the quantity of each item being purchased, and then displays the sale's subtotal, amount of sales tax and total ( see description of sales receipt)
This is what i have so far..... can someone please help me with this
, I would really appriciate it.
/**
This class hold data about itmes in a retail store.
*/
public class RetailItem
{
//declare variables
private String description;
private int unitsOnHand;
private double price;
//RetailIem class constructor
public RetailItem()
{
description = " ";
unitsOnHand = 0;
price = 0.00;
}
public RetailItem(String description, int unitsOnHand, double price)
{
setDescription(description);
setUnitsOnHand(unitsOnHand);
setPrice(price);
}
/* Method: setDescription
@param unitDescription The descriptions of the retail items.
*/
public void setDescription(String unitDescription)
{
description = unitDescription;
}
public void setUnitsOnHand(int units)
{
unitsOnHand = units;
}
public void setPrice(double thePrice)
{
price = thePrice;
}
public String getDescription()
{
return description;
}
public int getUnitsOnHand()
{
return unitsOnHand;
}
public double getPrice()
{
return price;
}
public String toString()
{
return "Items Sold: ";
}
}
/**
This class creates an object that holds all the items in the store's inventory.
*/
public class StoreInventory
{
public StoreInventory()
{
String addToInventory;
Double getTotalPrice;
int unitsOnHand;
RetailItem inventory[];
}
public String addToInventory()
{
addToInventory[1] = new RetailItem("Jacket");
addToInventory[2] = new RetailItem("Designer Jeans");
addToInventory[3] = new RetailItem("Shirt");
addToInventory[4] = new RetailItem("Silk Tie");
}
public double getTotalPriceOfInventory()
{
inventory[1] = new RetailItem("59.95");
inventory[2] = new RetailItem("34.95");
inventory[3] = new RetailItem("24.95");
inventory[4] = new RetailItem("12.95");
return (unitsOnHand * totalPriceOfInventory);
}
public int getUnitsOnHand()
{
unitsOnHand [1] = new RetailItem("12");
unitsOnHand [2] = new RetailItem("40");
unitsOnHand [3] = new RetailItem("20");
unitsOnHand [4] = new RetailItem("15");
}
}
[code]

New Topic/Question
Reply



MultiQuote



|