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 8 of 8

Thread: Need Help With My Task

  1. #1
    Junior Member
    Join Date
    May 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need Help With My Task

    Hi everybody,
    This is my task.I try to solve this problem but I couldnt understand nothing about print out part.


    //Write a main method which creates a new property object with id 0, price 550000, area 2100 and availability true.
    Print out its area in meters squared and then display the string form of the property object.//


    This my working.What is wrong in this code ?
    public class Property {
    private double id;
    private double price;
    private double area;
    private boolean availability;
    public void propertyAttributes()
    {
    System.out.println("id,price,area,availability"+id +price+area+availability);
    }

    public Property ()
    {
    id=0;
    price=550000;
    area=2100;
    availability=true;
    }
    public static void main(String[]args)
    {
    Property house=new Property();
    house.propertyAttributes();
    }
    }


  2. #2
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    609
    My Mood
    Sleepy
    Thanks
    10
    Thanked 93 Times in 86 Posts

    Default Re: Need Help With My Task

    What is wrong in this code ?
    No idea?! You tell us whats wrong. Does it make your toaster explode? Do you get errors?

  3. #3
    Junior Member
    Join Date
    May 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Need Help With My Task

    Yes I got a output but I think its not correct one.It should be depend on my code.
    This is my output.
    id,price,area,availability0.0550000.02100.0true

  4. #4
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    609
    My Mood
    Sleepy
    Thanks
    10
    Thanked 93 Times in 86 Posts

    Default Re: Need Help With My Task

    That's what you've programmed. What output did you expect?

  5. #5
    Junior Member
    Join Date
    May 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Need Help With My Task

    "Print out its area in meters squared and then display the string form of the property object"I think this is my statement.

  6. #6
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    609
    My Mood
    Sleepy
    Thanks
    10
    Thanked 93 Times in 86 Posts

    Default Re: Need Help With My Task

    Yes what does that look like? System.out.println("area,id,price,availability"are a++id +price+availability); would print area first. But I bet that is not what you want. What is your area value right now? squarefeet? Do you need to convert? How is the string form of the property object defined? Again, what do you expect to see?

  7. #7
    Junior Member
    Join Date
    May 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Need Help With My Task

    The most complicated part of the this task define to area for me.
    I think I need a output like this"System.out.println(“Is the house available? ” + house1.isAvailable());"

  8. #8
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    609
    My Mood
    Sleepy
    Thanks
    10
    Thanked 93 Times in 86 Posts

    Default Re: Need Help With My Task

    I have no idea how to help you, if you don't know what you need yourself.

Similar Threads

  1. [SOLVED] matrix task in java
    By mockingbird in forum What's Wrong With My Code?
    Replies: 16
    Last Post: May 14th, 2013, 04:14 PM
  2. pay task: java application.
    By chenaz in forum Paid Java Projects
    Replies: 0
    Last Post: July 11th, 2012, 09:54 AM
  3. how to implement Task Pane in Java
    By bashasmarty in forum Member Introductions
    Replies: 1
    Last Post: May 11th, 2012, 01:42 PM
  4. task manager
    By sayed shah in forum Object Oriented Programming
    Replies: 1
    Last Post: April 27th, 2012, 04:15 PM
  5. Ant Executes and Stops After a Certain Task
    By DanielPros in forum What's Wrong With My Code?
    Replies: 3
    Last Post: July 9th, 2011, 10:46 AM