Results 1 to 16 of 16
  1. #1
    camtheman is offline Member
    Join Date
    Dec 2010
    Posts
    7
    Rep Power
    0

    Unhappy not sure what I doing trying to get data to work

    I have a program I am trying to build and what to make a range of prices low, mid , high for three different rooms, using if statement but not sure if this will work or if the data will ever return right please help, here is what I have

    input is the rooms entered by a number before it worked fine before thanks


    System.out.println("Please enter your budget low, mid, high ");

    range=keyboard.nextLine();


    double base=10,price;



    if((input<=2) && (range=="low"||range=="LOW"||range=="Low"))
    {

    price= base+5;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    }
    else if((input<=2) && (range=="mid"||range=="Mid"||range=="MID"))
    {
    price=base*1.5;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    }
    else if((input<=2)&& (range=="high"||range=="High"||range=="HIGH"))

    {
    price=base*2;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    }
    else if((input>2 || input>5) &&(range=="low" || range=="Low"|| range=="LOW"))
    {
    price=base;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    }
    else if((input>2 || input>5) &&(range=="mid"||range=="Mid"||range=="MID"))
    {
    price=base*1.4;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    }
    else if((input>2 ||input>5) &&(range=="high"||range=="High"||range=="HIGH") )
    {
    price=base*1.8;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    }
    else if((input==5)&&(range=="low"||range=="Low"||range= ="LOW"))
    {
    price=base+3;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    }
    else if((input==5) &&(range=="mid"||range=="Mid"||range=="MID"))
    {
    price=base*1.5;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    }
    else if((input==5)&& (range=="high"||range=="High"||range=="HIGH"))
    {
    price=base*1.9;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    }

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    It's not clear what problem you're having.

    Does your code compile? If not and you can't understand the message, post the code and the complete compiler output.

    Does your program not do what you expect or intend when you run it? If so, post the code and describe both what the program actually does and what precisely you expect or intend the runtime behaviour to be.

    -------------------------------------

    Java Code:
    range=="low"

    This is almost certainly wrong. What you probably intend is

    Java Code:
    range.equals("low")

    equals() is a String method that checks whether two strings are made up of the same characters in the same order. ==, on the other hand, checks for identity. It is quite possible for two strings to be equal without their being identical (in which case they wouldn't be two strings...)

  3. #3
    camtheman is offline Member
    Join Date
    Dec 2010
    Posts
    7
    Rep Power
    0

    Default

    thanks that fixed the one problem will I be able to take my price variable out of these statements after?

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    12,999
    Blog Entries
    7
    Rep Power
    19

    Default

    Quote Originally Posted by camtheman View Post
    thanks that fixed the one problem will I be able to take my price variable out of these statements after?
    Your problems aren't solved yet because that entire sequence of if-else-if statements doesn't make sense; have a look:

    Java Code:
    else if((input>2 || input>5) &&(range=="low" || range=="Low"|| range=="LOW"))
    {
       ...
    }
    ...
    else if((input==5)&&(range=="low"||range=="Low"||range= ="LOW"))
    {
       ...
    }
    Ignoring the fact that you're trying to compare Strings with an == operator (Pbrockway2 already told you what to do instead), suppose input == 5. The first if condition will be true (input > 2) but I think you want to execute the last if statement.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    camtheman is offline Member
    Join Date
    Dec 2010
    Posts
    7
    Rep Power
    0

    Default

    :eek:thanks i did find those problems too, so the price variable how can I use it after the if else statements thanks

  6. #6
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    12,999
    Blog Entries
    7
    Rep Power
    19

    Default

    Quote Originally Posted by camtheman View Post
    :eek:thanks i did find those problems too, so the price variable how can I use it after the if else statements thanks
    Simply use it after your code has wobbled through all those if statements; make sure that variable is initialzed.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    camtheman is offline Member
    Join Date
    Dec 2010
    Posts
    7
    Rep Power
    0

    Question

    ok So I fixed the other poblems but now I want to use whatever price variable that becomes true in the if statements is there I way to do that here it is


    System.out.println("Please enter your budget range: low, mid, high ");//this became big pain trying to get the data to work out right

    range=keyboard.nextLine();


    double base=10,price=0.0;
    // double area=one.getarea()



    if((input<=2) && (range.equals("low")||range.equals("LOW")||range.e quals("Low")))
    {

    price= base+5;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    System.out.println("\n The total including tax will be "+(price*tax*one.getarea()));
    }

    else if((input<=2) && (range.equals("mid")||range.equals("Mid")||range.e quals("MID")))
    {
    price=base*1.5;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    System.out.println("\n The total including tax will be "+(price*tax*one.getarea()));
    }
    else if((input<=2)&& (range.equals("high")||range.equals("High")||range .equals("HIGH")))

    {

    price=base*2;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    System.out.println("\n The total including tax will be "+(price*tax*one.getarea()));
    }
    else if((input>2 && input>5) &&(range.equals("low") || range.equals("Low")|| range.equals("LOW")))
    {
    price=base;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    System.out.println("\n The total including tax will be "+(price*tax*one.getarea()));
    }
    else if((input>2 && input>5) &&(range.equals("mid")||range.equals("Mid")||range .equals("MID")))
    {
    price=base*1.4;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    System.out.println("\n The total including tax will be "+(price*tax*one.getarea()));
    }
    else if((input>2 && input>5) &&(range.equals("high")||range.equals("High")||ran ge.equals("HIGH")))
    {
    price=base*1.8;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    System.out.println("\n The total including tax will be "+(price*tax*one.getarea()));
    }
    else if((input==5)&&(range.equals("low")||range.equals( "Low")||range.equals("LOW")))
    {
    price=base+3;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    System.out.println("\n The total including tax will be "+(price*tax*one.getarea()));
    }
    else if((input==5) &&(range.equals("mid")||range.equals("Mid")||range .equals("MID")))
    {
    price=base*1.5;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
    System.out.println("\n The total including tax will be "+(price*tax*one.getarea()));
    }
    else if((input==5)&& (range.equals("high")||range.equals("High")||range .equals("HIGH")))
    {
    price=base*1.9;
    System.out.println("\n The price per sqr foot for your "+room.get(input-1)+" is "+price);
    System.out.println("\n The total including tax will be "+(price*tax*one.getarea()));
    }
    :confused:

  8. #8
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    When you see a bunch of lines that pretty much look alike in your code, it's a pretty good clue that you really want a loop or a method or both.

    You seem to be trying to choose a price formula from a table that looks like this:
    Java Code:
                Low     Medium  High
    i <= 2      b+5     b*1.5   b*2 
    2 < i < 5   b       b*1.4   b*1.8
    i = 5       b+3     b*1.5   b*1.9
    It also looks like you want price to be a double (which is actually a poor choice for a money value, but we'll save that lesson for another time). So you should write a method something like this:
    Java Code:
            private double computePrice(int input, String range) {
                    double result = -1.0; // default for bad input or range
                    if (range.equalsIgnoreCase("low") {
                             if (input <= 2 ) {
                                     result = base + 5
                             } else if (2 < input && input < 5) {
                                     result = base;
                             } else if (input == 5) {
                                     result = base + 3;
                             }
                    } else if (range.equalsIgnoreCase("medium") {
                            // TODO write this part
                    } else if (range.equalsIgnoreCase("high") {
                            // TODO write this part
                    }
                    return result;
            }
    Then you want another method to do your printing. (It would be better style to return a String rather than print it directly, but that will have to wait for a later lesson too.)
    Java Code:
            private void printPriceInfo(int input, String range) {
                    double price = computePrice(input, range);
                    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);
                    System.out.println("\n The total including tax will be "+(price*tax*one.getarea()));
            }
    Good luck!

    -Gary-

  9. #9
    camtheman is offline Member
    Join Date
    Dec 2010
    Posts
    7
    Rep Power
    0

    Default

    thanks gary I got the decial formated so no problem with the money and thanks so much again

  10. #10
    camtheman is offline Member
    Join Date
    Dec 2010
    Posts
    7
    Rep Power
    0

    Default

    can I take two objects from a do while loop and save them everytime in runs then print them all out latter? this is my code it works I just would like to take each enrty and print them all out at the end what why should I do this?


    do{// this way we can do as many rooms as you want

    //Scanner keyboard = new Scanner (System.in);put these here but they did not work right because I needed them after do while
    //DecimalFormat fix = new DecimalFormat("#.00");

    System.out.println("\t \n Hello! Welcome to Your Reno Estmeter"+"\n\t*********************************** ***");//this is what I did for a living for about 15 years so I should know A few things about it.
    System.out.println("\nPlease take your time and this progam will help you save a lot of money!!!");
    System.out.println("\nPlease choose a Room in your house you would like to Reno.");

    ArrayList room = new ArrayList();//I like the idea of an Arraylist so I thought I would use one, sure this could be done many different ways.
    room.add(" Bathroom");//thinking of using class to make these rooms come to life still not sure all that I can do with classes but we will see
    room.add(" Kitchen");
    room.add(" Bedroom");
    room.add(" Living room");
    room.add(" Basement");

    System.out.println("\n *****1"+room.get(0)+"} 2"+room.get(1)+"} 3"+room.get(2)+"} 4"+room.get(3)+"} 5"+room.get(4)+"}****");//output with each room from arraylist
    System.out.println("----------------------------------------------------------------------------------------------------");
    System.out.println("\nPlease enter the number on the left of the name to give me your choice");//using numbers to make it easier in my mind anyways.
    input= keyboard.nextInt ();

    while (input <1 || input>5)//while statement to stop unwanted input works great
    {
    System.out.println("\nSorry that is not one of the rooms in this planner "+
    "please make another selection");
    System.out.println("1"+room.get(0)+" 2"+room.get(1)+" 3"+room.get(2)+" 4"+room.get(3)+" 5"+room.get(4));
    input= keyboard.nextInt ();
    }
    //System.out.println(room.get(input-1)); put this in as a test of the print do not need it now
    System.out.println(" Good! Who does not want a new"+room.get(input-1)+"?");
    System.out.println("\nOk let's get some info so we can get you some prices :)");

    roombuilder one= new roombuilder();//build of the rooms size and height in roombuilder class

    System.out.println("\n A good place to start is with the size of your room.\n Please give me the length of your "+room.get(input-1)+" in feet and inches, for example, 10.6 feet");
    in1=keyboard.nextDouble();
    one.setlength(in1);
    System.out.println();

    System.out.println(" Ok now we need the width, please enter a width, following the same format");
    in2=keyboard.nextDouble();
    one.setwidth(in2);

    System.out.println("It would be very helpful if we could have the height of you ceilings too, so please enter your height");
    in3=keyboard.nextDouble();
    one.setheight(in3);

    System.out.println("\n Ok, so we have a length of "+fix.format(one.getlength())+" and we have a width of "+fix.format(one.getwidth())+" this gives us an area of "
    +fix.format(one.getarea())+" and our height is "+one.getheight());
    System.out.println();
    keyboard.nextLine();

    System.out.println("Please enter your budget range: low, mid, high ");//this became big pain trying to get the data to work out right

    range=keyboard.nextLine();









    if((input<=2) && (range.equalsIgnoreCase("low")))//wow this saves time from all this other stuff I did should have used method here but did not want to erase after solved problems
    {

    price= base+5;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }

    else if((input<=2) && (range.equals("mid")||range.equals("Mid")||range.e quals("MID")))
    {
    price=base*1.5;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);


    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else if((input<=2)&& (range.equals("high")||range.equals("High")||range .equals("HIGH")))

    {

    price=base*2;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else if((input>2 && input<5) &&(range.equals("low") || range.equals("Low")|| range.equals("LOW")))
    {
    price=base;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else if((input>2 && input<5) &&(range.equals("mid")||range.equals("Mid")||range .equals("MID")))
    {
    price=base*1.4;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else if((input>2 && input<5) &&(range.equals("high")||range.equals("High")||ran ge.equals("HIGH")))
    {
    price=base*1.8;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else if((input==5)&&(range.equals("low")||range.equals( "Low")||range.equals("LOW")))
    {
    price=base+3;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else if((input==5) &&(range.equals("mid")||range.equals("Mid")||range .equals("MID")))
    {
    price=base*1.5;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else if((input==5)&& (range.equals("high")||range.equals("High")||range .equals("HIGH")))
    {
    price=base*1.9;
    System.out.println("\n The price per sqr foot for your "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your"+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else
    {
    System.out.println("you made a data entery error please keep going");
    count=count-1;
    }

    total+=price*one.getarea()*tax;
    count=count+1;
    System.out.println("\n ***Would you like to do another room, enter Y if you do***");
    System.out.println(" ----------------------------------------------------------");
    in=keyboard.nextLine();
    repeat=in.charAt(0);

    //System.out.println(price);

  11. #11
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Location
    Waterford, Ireland
    Posts
    748
    Rep Power
    5

    Default

    Please use code tags when posting code
    Last edited by al_Marshy_1981; 12-12-2010 at 03:15 AM. Reason: ...

  12. #12
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Location
    Waterford, Ireland
    Posts
    748
    Rep Power
    5

    Default

    money? use BigDecimal, im convinced that is what gary meant.

  13. #13
    camtheman is offline Member
    Join Date
    Dec 2010
    Posts
    7
    Rep Power
    0

    Default

    I mean after the whole loop runs I would like to save the room they entered and the cost each time so I can print out each one at the end, how do I save this each time the do/while loop run and print them all out latter?



    do{// this way we can do as many rooms as you want

    //Scanner keyboard = new Scanner (System.in);put these here but they did not work right because I needed them after do while
    //DecimalFormat fix = new DecimalFormat("#.00");

    System.out.println("\t \n Hello! Welcome to Your Reno Estmeter"+"\n\t*********************************** ***");//this is what I did for a living for about 15 years so I should know A few things about it.
    System.out.println("\nPlease take your time and this progam will help you save a lot of money!!!");
    System.out.println("\nPlease choose a Room in your house you would like to Reno.");

    ArrayList room = new ArrayList();//I like the idea of an Arraylist so I thought I would use one, sure this could be done many different ways.
    room.add(" Bathroom");//thinking of using class to make these rooms come to life still not sure all that I can do with classes but we will see
    room.add(" Kitchen");
    room.add(" Bedroom");
    room.add(" Living room");
    room.add(" Basement");

    System.out.println("\n *****1"+room.get(0)+"} 2"+room.get(1)+"} 3"+room.get(2)+"} 4"+room.get(3)+"} 5"+room.get(4)+"}****");//output with each room from arraylist
    System.out.println("----------------------------------------------------------------------------------------------------");
    System.out.println("\nPlease enter the number on the left of the name to give me your choice");//using numbers to make it easier in my mind anyways.
    input= keyboard.nextInt ();

    while (input <1 || input>5)//while statement to stop unwanted input works great
    {
    System.out.println("\nSorry that is not one of the rooms in this planner "+
    "please make another selection");
    System.out.println("1"+room.get(0)+" 2"+room.get(1)+" 3"+room.get(2)+" 4"+room.get(3)+" 5"+room.get(4));
    input= keyboard.nextInt ();
    }
    //System.out.println(room.get(input-1)); put this in as a test of the print do not need it now
    System.out.println(" Good! Who does not want a new"+room.get(input-1)+"?");
    System.out.println("\nOk let's get some info so we can get you some prices :)");

    roombuilder one= new roombuilder();//build of the rooms size and height in roombuilder class

    System.out.println("\n A good place to start is with the size of your room.\n Please give me the length of your "+room.get(input-1)+" in feet and inches, for example, 10.6 feet");
    in1=keyboard.nextDouble();
    one.setlength(in1);
    System.out.println();

    System.out.println(" Ok now we need the width, please enter a width, following the same format");
    in2=keyboard.nextDouble();
    one.setwidth(in2);

    System.out.println("It would be very helpful if we could have the height of you ceilings too, so please enter your height");
    in3=keyboard.nextDouble();
    one.setheight(in3);

    System.out.println("\n Ok, so we have a length of "+fix.format(one.getlength())+" and we have a width of "+fix.format(one.getwidth())+" this gives us an area of "
    +fix.format(one.getarea())+" and our height is "+one.getheight());
    System.out.println();
    keyboard.nextLine();

    System.out.println("Please enter your budget range: low, mid, high ");//this became big pain trying to get the data to work out right

    range=keyboard.nextLine();









    if((input<=2) && (range.equalsIgnoreCase("low")))//wow this saves time from all this other stuff I did should have used method here but did not want to erase after solved problems
    {

    price= base+5;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }

    else if((input<=2) && (range.equals("mid")||range.equals("Mid")||range.e quals("MID")))
    {
    price=base*1.5;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);


    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else if((input<=2)&& (range.equals("high")||range.equals("High")||range .equals("HIGH")))

    {

    price=base*2;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else if((input>2 && input<5) &&(range.equals("low") || range.equals("Low")|| range.equals("LOW")))
    {
    price=base;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else if((input>2 && input<5) &&(range.equals("mid")||range.equals("Mid")||range .equals("MID")))
    {
    price=base*1.4;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else if((input>2 && input<5) &&(range.equals("high")||range.equals("High")||ran ge.equals("HIGH")))
    {
    price=base*1.8;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else if((input==5)&&(range.equals("low")||range.equals( "Low")||range.equals("LOW")))
    {
    price=base+3;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else if((input==5) &&(range.equals("mid")||range.equals("Mid")||range .equals("MID")))
    {
    price=base*1.5;
    System.out.println("\n The price per sqr foot for "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your "+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else if((input==5)&& (range.equals("high")||range.equals("High")||range .equals("HIGH")))
    {
    price=base*1.9;
    System.out.println("\n The price per sqr foot for your "+room.get(input-1)+" is "+price);

    System.out.println("\n The total including before tax will be "+fix.format(price*one.getarea()));
    System.out.println("\n The total including tax for your"+room.get(input-1)+" "+fix.format(price*tax*one.getarea()));
    }
    else
    {
    System.out.println("you made a data entery error please keep going");
    count=count-1;
    }

    total+=price*one.getarea()*tax;
    count=count+1;
    System.out.println("\n ***Would you like to do another room, enter Y if you do***");
    System.out.println(" ----------------------------------------------------------");
    in=keyboard.nextLine();
    repeat=in.charAt(0);

    //System.out.println(price);

  14. #14
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Location
    Waterford, Ireland
    Posts
    748
    Rep Power
    5

    Default

    please use code tags, hint... wrap code up in this

    [code]


    [/cod] but you know an 'e' after 'd'

  15. #15
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Location
    Waterford, Ireland
    Posts
    748
    Rep Power
    5

    Default

    I am not trying to be annoying but personally I am not going to read your code because its format is so poor when others make the effort and also I do not have time to dicipher your code and your poor indentation on top of that, understand? most will feel the same so I am trying to help you get the most and best answers around.
    Last edited by al_Marshy_1981; 12-12-2010 at 03:40 AM. Reason: ...

  16. #16
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    It's clear you are just getting started with Java. And that's great -- we were all there once. It's also very good that you have an idea of a project in mind, as that will help keep you motivated, and help to make things concrete as you learn them. But don't be in a hurry. That will only make things take longer. Take the time to learn things step-by-step. There are no shortcuts.

    You should work through at least the Basic Trail of the Java Tutorials.

    The Java™ Tutorials

    Then you should work through all of Mark Dexter's tutorials:

    Eclipse and Java for Total Beginners
    Using the Eclipse Workbench
    Introducing Persistence
    Using the Debugger

    Actually, it might not be a bad approach to start with the Mark Dexter tutorials, then do the Oracle Java Tutorials, then do the Mark Dexter tutorials again. The Mark Dexter tutorials are step-by-step work-alongs, and you will definitely learn a lot very quickly by working through them.

    -Gary-

Similar Threads

  1. data structure and data base??
    By ahmed13 in forum Advanced Java
    Replies: 8
    Last Post: 03-27-2009, 05:48 AM
  2. how to store the data in data base
    By eclipse3.4ide in forum New To Java
    Replies: 5
    Last Post: 02-03-2009, 04:25 AM
  3. error while retrieving data from data base
    By kirtesh4u in forum New To Java
    Replies: 5
    Last Post: 11-15-2008, 04:10 PM
  4. Replies: 0
    Last Post: 10-31-2008, 02:13 PM
  5. Data Sorting in a .data file using java
    By stutiger99 in forum New To Java
    Replies: 2
    Last Post: 10-08-2008, 02:52 AM

Posting Permissions

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