Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: problem !!!!!

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question problem !!!!!

    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package westfield;
     
    /**
     *
     * @author TOSHIBA
     */
    public class roomCarpet
    {
     
    private roomDimension roomDimension;
    private int cost;
     
    public roomCarpet(int length, int width)
     
    {
     
          void setcost(int cost) {
           this.cost = cost;
        }
     
         public  int getcost() {
           return cost;
        }
     
        roomDimension = new roomDimension(length, width);
     
     
    }
     
     
    public int totalCost()
    {
    return roomDimension.roomArea() * cost;
    }
     
    }



    i don't know what is the problem with it there is mistake in geters ! or setter ?! and the last return type


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: problem !!!!!

    don't know what is the problem with it
    You'll have to explain.
    Are there any error messages? If so copy the full text and paste here.
    If the code executes and gives the wrong output, copy the output, paste it here and explain what is wrong with it and show what it should be.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: problem !!!!!

    package westfield;
     
    /**
     *
     * @author TOSHIBA
     */
    public class WestField {
     
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            // TODO code application logic here
        }
    }
     
     
     
    package westfield;
     
    /**
     *
     * @author TOSHIBA
     */
    public class roomCarpet
    {
     
    private roomDimension roomDimension;
    private int cost;
     
    public roomCarpet(int length, int width)
     
    {
     
          void setcost(int cost) {
           this.cost = cost;
        }
     
         public  int getcost() {
           return cost;
        }
     
        roomDimension = new roomDimension(length, width);
     
     
    }
     
     
    public int totalCost()
    {
    return roomDimension.roomArea() * cost;
    }
     
    }
     
     
     
    package westfield;
     
    /**
     *
     * @author TOSHIBA
     */
    public class roomDimension
     
    {
    private int length;
    private int width;
     
    public roomDimension(int length, int width)
    {
    this.length = length;
    this.width = width;
    }
     
    public int roomArea()
    {
    return width * length;
    }
     
    }

    the problem with the sitters , getters and public class room dimension ??!!
    and room carpet class !!

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: problem !!!!!

    Please explain what the problem is.

    Are there any error messages? If so copy the full text of the error messages and paste here.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 3
    Last Post: January 5th, 2012, 01:44 AM