Question

In: Computer Science

Problem1. James goes to restaurant for dinner. The items he orders are soup for $3.99, sandwich...

Problem1. James goes to restaurant for dinner. The items he orders are soup for $3.99, sandwich for $5.99 and a drink for $2.99, peach cobbler for $4.99. Calculate the subtotal, gratuity and total if the gratuity rate is 20%.

Problem2. Write a program which reads in an integer from the user and then prints out the last digit of the number that is 4 times the value which the user entered.

For example, if a user enters the number 52 , your program will compute the number 4*52=208 and print out the last digit which is 8.

Note: Use the modulo operator (%)

Problem3. Compute the volume of cylinder if the radius of the cylinder is 9 and length is 16. Assume the value of “pi” as 3.1415. Use the formula given below.

area = radius *radius*pi

volume = area *length

Solutions

Expert Solution

Answer 1:

subtotal=3.99+5.99+2.99+4.99

gratuity=subtotal*0.2

total=subtotal+gratuity

print("Sub total: ",subtotal)

print("Gratuity: ",gratuity)

print("Total: ",total)

Answer 2:

num=int(input("Enter number: "))

#adding 4 times

num=num*4

#printing last digit

print("Last digit: ",(num%10))

radius=9

length=16

pi=3.1415

#finding area

area = radius *radius*pi

#finding volume

volume = area *length

print("Area: ",area)

print("Volume: ",volume)

Note : If you like my answer please rate and help me it is very Imp for me


Related Solutions

James is a new salesperson. He is attending his first formal dinner party at the Chamber...
James is a new salesperson. He is attending his first formal dinner party at the Chamber of Commerce. He knows that he will meet a lot of people who can help him become a successful salesperson, but he needs information on how to make the most of this networking opportunity. What advice would you give him?
. Manuel takes his family to the Space Needle Restaurant for a special dinner celebration. He...
. Manuel takes his family to the Space Needle Restaurant for a special dinner celebration. He drives to the valet parking area, where the staff takes his keys and parks the car for Manuel. They give him a “claim check” for when the family is ready to pick up the car. The valet service costs $10. When Manuel and family have finished dinner, they present their claim check, but are informed that the car is missing – it must have...
Advise the restaurant manager of measures he could use to improve the menu items identified as...
Advise the restaurant manager of measures he could use to improve the menu items identified as plow-horses and puzzles on his offerings.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT