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

Thread: i need help

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default i need help

    1.Write a program that asks the user to enter a favorite color, a favorite food, a favorite animal, and the first name of a friend or relative. The program should then print the following two lines, with the user’s input replacing the items in italics.
    I had a dream that Name ate a Color Animal and said it tasted like Food.
    For example, if the user entered blue for color, hamburger for food, frog for the animal, and Jake for the person’s name, the output would be
    I had a dream that Jake ate a blue frog and said it tasted like hamburger.

    2. Write a program that computes the tax and tip on a restaurant bill. Ask the user to input the following information:
    • Price of the appetizer
    • Price of the entree
    • Price of the dessert
    • Price of the drink
    • Number of people in the party
    Now, display the following:
    • Cost of the meal for one person without including tax or tip.
    • Total cost of the meal for the entire party without tax and tip. Assume that the cost per meal is the same for all persons in the party
    • The tax amount. The tax rate is 8.25 percent. Use a named constant for the tax rate.
    • The tip amount. The tip is 15% of the total bill after adding the tax. Use a named constant for the tip.
    • Total cost of the meal for the entire party with tax and tip.


    3.Write a program that reads a 4 digit integer and adds all the digits in the integer. For example, if an integer is 9324, the sum of all its digits is 18.
    Hint: Use the % operator to extract the digits, and use the / operator to remove the extracted digit.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,140
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: i need help

    Do you have any specific questions about your assignment?
    Please post your code and any questions about problems you are having.

    What have you tried?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Jan 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: i need help

    1.Write a program that asks the user to enter a favorite color, a favorite food, a favorite animal, and the first name of a friend or relative. The program should then print the following two lines, with the user’s input replacing the items in italics.
    I had a dream that Name ate a Color Animal and said it tasted like Food.
    For example, if the user entered blue for color, hamburger for food, frog for the animal, and Jake for the person’s name, the output would be
    I had a dream that Jake ate a blue frog and said it tasted like hamburger.

    2. Write a program that computes the tax and tip on a restaurant bill. Ask the user to input the following information:
    • Price of the appetizer
    • Price of the entree
    • Price of the dessert
    • Price of the drink
    • Number of people in the party
    Now, display the following:
    • Cost of the meal for one person without including tax or tip.
    • Total cost of the meal for the entire party without tax and tip. Assume that the cost per meal is the same for all persons in the party
    • The tax amount. The tax rate is 8.25 percent. Use a named constant for the tax rate.
    • The tip amount. The tip is 15% of the total bill after adding the tax. Use a named constant for the tip.
    • Total cost of the meal for the entire party with tax and tip.


    3.Write a program that reads a 4 digit integer and adds all the digits in the integer. For example, if an integer is 9324, the sum of all its digits is 18.
    Hint: Use the % operator to extract the digits, and use the / operator to remove the extracted digit.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,140
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: i need help

    Why repeat post #1? See my post#2
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: i need help

    What you've done is to post your entire assignment without showing what work you've done, and that is not how to get help here (or at any forum). For one, we have no idea what you're having trouble with, so we won't know how to advise you. For another, it suggests that you want someone to post a complete solution, thereby doing your homework for you, and I know that this was not your intent.

    So please try to solve the problem first, and then post what you've done using code tags (see the FAQ), and then ask a specific question. Do this and you'll have many folks willing to help you.

    If you have absolutely no idea where to start, please have a look at this site here as it will give you some ideas: Starting Writing a Program

    If you're still having problems, then please talk to your instructor.

    Much luck!

Tags for this Thread