Results 1 to 3 of 3
  1. #1
    jonvh432 is offline Member
    Join Date
    Jan 2011
    Rep Power

    Default 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()
    return decription;

    //Get the Units on Hand
    public int getUnitsOnHand()
    return unitsOnHand;
    //Get the items price
    public double getPrice()
    return price;

    the output is posted as an attachment
    Attached Thumbnails Attached Thumbnails New to Java Need Help!!!-output.jpg  

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Rep Power


    Assignment dump. Check
    Code dump. Check.
    Question. Fail.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts