1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sergij07 [2.7K]
2 years ago
6

Problem 1 Calculating the tip when you go to a restaurant is not difficult, but your restaurant wants to suggest a tip according

to the service diners receive. Write a program that calculates a tip according to the diner’s satisfaction as follows: •Ask for bill amount •Ask for the diners’ satisfaction level using these ratings: 1 = Totally satisfied, 2 = Satisfied, 3 = Dissatisfied. •If the diner is totally satisfied, calculate a 20 percent tip. •If the diner is satisfied, calculate a 15 percent tip. •If the diner is dissatisfied, calculate a 10 percent tip. •Report the satisfaction level and tip in dollars and cents Format tips to 2 decimal points; if the bill is 105$ and satisfaction level is 3, then the tip will be $10.50
Computers and Technology
1 answer:
DIA [1.3K]2 years ago
4 0

Answer:

bill = float(input("Enter the bill amount: "))

rating = int(input("Choose a rating: 1 = Totally satisfied, 2 = Satisfied, 3 = Dissatisfied.: "))

if rating is 1:

   tip = bill * 0.2

elif rating is 2:

   tip = bill * 0.15

elif rating is 3:

   tip = bill * 0.1

print("The rating is: " + str(rating))

print("The tip is: $%.2f" % (tip))

Explanation:

*The code is in Python

- Ask the user for the <em>bill</em> and <em>rating</em>

- Depending on the <em>rating</em>, calculate the <em>tip</em> using <u>if else</u> statement i.e. If the rating is chosen as 1, calculate the tip by taking 20 percent of the bill.

- Print the <em>rating</em> and the <em>tip</em>

You might be interested in
How do open online courses help with independent learning? (1 point)
Dominik [7]

I personally have online courses, A. seems like a fitting choice in my opinion. I hope this helps.

4 0
3 years ago
Read 2 more answers
The following 2D array has been created:
Airida [17]

Answer:

public class Main

{

public static void main(String[] args) {

 

 int [][] a = new int[4][5];

 

 a[0][0] = 1;

 a[0][1] = 2;

 a[0][2] = 3;

 a[0][3] = 4;

 a[0][4] = 5;

 a[1][0] = 10;

 a[1][1] = 9;

 a[1][2] = 8;

 a[1][3] = 7;

 a[1][4] = 6;

 a[2][0] = 11;

 a[2][1] = 12;

 a[2][2] = 13;

 a[2][3] = 14;

 a[2][4] = 15;

 a[3][0] = 20;

 a[3][1] = 19;

 a[3][2] = 18;

 a[3][3] = 17;

 a[3][4] = 16;

 

 for (int i = 0; i < 4; i++) {

     for (int j = 0; j < 5; j++){

         System.out.print(a[i][j] + " ");

     }

     System.out.print("\n");

 }

}

}

Explanation:

  • Inside the main method, initialize the 2D array with their respective values at the appropriate indexes.
  • Iterate over the 2D array using a nested For loop.
  • The outer loop iterates over the rows, while the inner loop iterates over the columns of the 2D array respectively.
  • Finally inside the nested For loop, print the value of 2D array using the i and j index.

Output:

1 2 3 4 5

10 9 8 7 6

11 12 13 14 15

20 19 18 17 16

4 0
3 years ago
Read 2 more answers
A student wants an algorithm to find the hardest spelling word in a list of vocabulary. They define hardest by the longest word.
makkiz [27]

Answer:

Initialize the “longest word” by an empty string and update it when a longer word is found

Explanation:

import java.util.stream.Stream;

public static String findLongest(String[] spellingList) {

   return Stream.of(spellingList).reduce("", (longestWord, word) -> (

       longestWord.length() < word.length() ? word : longestWord

   ));

}

5 0
2 years ago
Three different numbers need to be placed in order from least to greatest. For example, if the numbers are ordered 9, 16, 4, the
Savatey [412]

Answer:

what are the three different numbers?

8 0
2 years ago
How do you fix peer answer bad gateway 502. Please help
kondaur [170]

Answer:

Reload the page.

Look for server connectivity issues.

Check for any DNS changes.

Sift through your logs.

Fix faulty firewall configurations.

Comb through your website's code to find bugs.

Contact your host.

Explanation:

7 0
3 years ago
Other questions:
  • A. True
    14·2 answers
  • Microsoft access does not create n:m relationships because microsoft access creates databases based on
    7·1 answer
  • Which tab provide text formatting features
    11·1 answer
  • According to the Computing Research Association, the number of undergraduate degrees awarded in computer science at doctoral-gra
    11·1 answer
  • In general, digital to analog modulation equipment is less expensive than the equipment for encoding digital data into a digital
    8·1 answer
  • What the central difference between negative and positive politeness?
    13·2 answers
  • What types of company functions are aided by ERP?
    9·1 answer
  • Which of the following is an example of machine learning?
    5·1 answer
  • You work part-time at a computer repair store. You're building a new computer. The customer has requested two serial ATA (SATA)
    8·1 answer
  • oe, a user, receives an email from a popular video streaming website. the email urges him to renew his membership. the message a
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!