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

Thread: I can't figure this out! Please help!

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Unhappy I can't figure this out! Please help!

    I am taking my first java class so I am not very good at this. My problem is that I can't figure out how to make part of my code work. Everything works but this part. I know it is wrong, but I have no idea how else to do it. I feel bad e-mailing my teacher on the weekend, so if you guys help me I would really appreciate it. Thank you very much!

    HTML Code:
    		System.out.println("Do you want trees to be delivered? \n"
    								+"1 for Yes\t"
    								+ "0 for No");
    								
    
    		forDelivery = keyboard.nextInt();
    
    		
    		if(forDelivery == 1)
    		   {
    			(singleTree < 5) &&  (deliveryCost== 10.00) // this is the area that I have
    			(singleTree >=5) && (deliveryCost==50.00)// no clue how to write properly 
     		System.out.println("There will be a delivery charge according to how many trees you ordered.");
    
    	else if (forDelivery == 0) 
    			{
    	 System.out.println("In-Store Pickup will be available after 4 PM");
    			}
    		 
    
    			}


  2. #2
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    976
    Thanks
    7
    Thanked 205 Times in 181 Posts

    Default Re: I can't figure this out! Please help!

    Say what the problem is: ie what happens when you run the code, and what you expect or want to happen.

    Also it may be a good idea to clean up the format of the code. Remove any distracting left hand indents if they are common to all the lines. And have the { and } pairs line up (with any nested pairs also lining up, but with more indent.)

  3. The Following User Says Thank You to pbrockway2 For This Useful Post:

    angyvill85 (June 30th, 2012)

  4. #3
    Junior Member
    Join Date
    Jul 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I can't figure this out! Please help!

    Please explain the problem and expected result?

Similar Threads

  1. Help with my program please :) I can't figure this out.
    By scholaryoshi in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 24th, 2012, 07:31 AM
  2. I can't figure out why i keep getting this error
    By chrissy2860 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 17th, 2011, 04:06 PM
  3. just one more error that i cannot figure out please help me.
    By knoxy5467 in forum What's Wrong With My Code?
    Replies: 31
    Last Post: June 14th, 2011, 10:04 AM
  4. [SOLVED] can't figure out..
    By darego in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 10th, 2010, 02:26 PM
  5. I'm new at this and can't figure it out
    By jaheh06 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: September 22nd, 2010, 09:44 AM

Tags for this Thread