Results 1 to 3 of 3
Thread: New to Java Need Help!!!
- 01-28-2011, 04:26 AM #1Member
- Join Date
- Jan 2011
- Rep Power
New to Java Need Help!!!
I need some major help with this program.
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 field is 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 variable that holds the item's retail price
Write a public constructor method that accepts three arguments, description, units, & price, and stores the values of the arguments passed into it in the object's instance fields
Write three public getter methods to retrieve the values from the three fields
String getDescription( )
int getUnitsOnHand( )
double getPrice( )
Write a separate class called Inventory with a main method that creates three RetailItem objects and then produces a neatly formatted table of the store's inventory (only three items)
So far this is what i have
public class retailItem
private String description;
private int unitsOnHand;
private double price;
public retailItem(String d, int m, double p)
description = d;
unitsOnHand = m;
price = p;
//Get the items description
public String getDescription()
//Get the Units on Hand
public int getUnitsOnHand()
//Get the items price
public double getPrice()
the output is posted as an attachment
- 01-28-2011, 04:28 AM #2
Assignment dump. Check
Code dump. Check.
As Junky succinctly states, no where in your post above do you ask a coherent question. Please read the link in my signature links below on how to ask smart questions where you'll find tips on how to make your question actually answerable.