inventory Program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • idgirl
    New Member
    • Feb 2008
    • 1

    inventory Program

    I am having a hard time with this class. I am new to java and do not understand it or what I am doing. I need to add in a method for the 5% re-stocking fee and a sort array. I thought I had done that but the teacher said it is not there can anyone help me please?

    Here is my code:
    [CODE=Java]
    public class MovieInventory
    {
    public static void main(String args[]){
    DVD dvd;

    dvd = new DVD("Grumpy old men",1,1,17.00) ;
    System.out.prin tln(dvd);

    dvd = new DVD("Grumpier Old Men",2,1,17.00) ;
    System.out.prin tln(dvd);

    dvd = new DVD("Pretty Woman",3,1,19.9 5);
    System.out.prin tln(dvd);

    dvd = new DVD("Goast",4,1 ,19.95);
    System.out.prin tln(dvd);

    dvd = new DVD("Gone with the Wind",5,1,11.00 );
    System.out.prin tln(dvd);

    }//end main

    public Object getPrice;

    public Object getPrice() {
    return null;
    }
    }//end class MovieInventory

    class DVD{
    private String dvdTitle;
    private double dvdStock;
    private double dvdPrice;
    private double dvdItem;
    public Object reStockFee;

    public DVD(String Title, double Stock, double Price, double Item){
    dvdTitle = Title;
    dvdStock = Stock;
    dvdPrice = Price;
    dvdItem = Item;
    }//end constructor argument

    //set DVD Item
    public void setDVDItem(int item){
    dvdItem = item;
    }//end method set DVD Item

    //return DVD Item
    public double getDVDItem(){
    return dvdItem;
    }//end method get DVD Item

    //set DVD Title
    public void setDVDTitle(Str ing Title){
    dvdTitle = Title;
    }//end method set DVD Title

    //return DVD Title
    public String detDVDTitle(){
    return dvdTitle;
    }//end method get DVD Title

    public void setDVDStock(dou ble Stock){
    dvdStock = Stock;
    }//end method set DVD Stock

    //return DVD Stock
    public double getDVDStock(){
    return dvdStock;
    }//end method get DVD Stock

    public void setDVDPrice(dou ble Price){
    dvdPrice = Price;
    }//end method Set DVD Price

    //return DVD price
    public double getDVDPrice(){
    return dvdPrice;
    }//end method get DVD Price

    //calculate inventory value
    public double value(){
    return dvdPrice * dvdStock;
    }//end method value

    public double calcValue(int Price, int Stock )
    {
    return Stock*Price;
    }

    public String toString1()
    {
    return "Product: " + dvdTitle + "\n" +
    "Product Item: " + dvdItem + "\n" +
    "Qty In Stock: " + dvdStock + "\n" +
    "Product Price: $" + dvdPrice + "\n" +
    "Stock Value: $" + calcValue(0, 0);}

    public class Dvd extends MovieInventory{
    private double price;

    public Dvd(double price) {
    this.price = price;
    }
    public double getprice(){
    return this.price;
    }
    public String toString1() {
    return new StringBuffer(). append("Price:" + getPrice()).toS tring();
    }
    {
    }

    public String toString(){
    return String.format(" %-20s %-20s %-20s %-20s", dvdTitle,dvdIte m,dvdStock,dvdP rice, value());
    }
    }
    }
    //end class DVD[/CODE]
    Last edited by BigDaddyLH; Feb 28 '08, 04:32 AM. Reason: code tags
  • BigDaddyLH
    Recognized Expert Top Contributor
    • Dec 2007
    • 1216

    #2
    Originally posted by idgirl
    I need to add in a method for the 5% re-stocking fee and a sort array. I thought I had done that but the teacher said it is not there can anyone help me please?
    If you have done that could you point out the code that
    1) implements the 5% re-stocking fee
    and
    2) "a sort array"
    Like your teacher I have trouble finding them.

    Comment

    • BigDaddyLH
      Recognized Expert Top Contributor
      • Dec 2007
      • 1216

      #3
      Please enclose your posted code in [code] tags (See How to Ask a Question).

      This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

      Please use [code] tags in future.

      MODERATOR

      Comment

      • hollywood115
        New Member
        • Feb 2008
        • 16

        #4
        Originally posted by BigDaddyLH
        If you have done that could you point out the code that
        1) implements the 5% re-stocking fee
        and
        2) "a sort array"
        Like your teacher I have trouble finding them.
        i don't see it either...
        point out to us what u believe to be the method you are talking about.

        Comment

        Working...