# i need help

• January 30th, 2013, 06:29 PM
sopeojo
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.
• January 30th, 2013, 06:33 PM
Norm
Re: i need help

What have you tried?
• January 30th, 2013, 06:43 PM
sopeojo
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.
• January 30th, 2013, 06:45 PM
Norm
Re: i need help
Why repeat post #1? See my post#2
• January 30th, 2013, 09:07 PM
curmudgeon
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