The program that you create for this exercise will begin by reading the cost of a meal ordered at a restaurant from the user. Then your program will compute the tax and tip for the meal. Use your local tax rate when computing the amount of tax owing. Compute the tip as 18 percent of the meal amount (without the tax). The output from your program should include the tax amount, the tip amount, and the grand total for the meal including both the tax and the tip. Format the output so that all of the values are displayed using two decimal places.

Answers

Answer 1
Answer:

The program is a sequential program; as such, it does not require loops or conditional statements.

The program in Python, where comments are used to explain each line is as follows:

#This gets input for the cost of the meal

cost = float(input("Cost: "))

#This initializes the local rate tax to 7.25%

local_rate_tax = 0.0725

#This initializes the tip to 18%

tip = 0.18

#This calculates the tax amount

taxAmount = cost * local_rate_tax

#This calculates the tip amount

tipAmount = cost * tip

#This calculates the grand total

grand = cost + taxAmount + tipAmount

#This prints the tax amount

print("Tax amount: {:.2f}".format(taxAmount))

#This prints the tip amount

print("Tip: {:.2f}".format(tipAmount))

#This prints the grand total

print("Grand total: {:.2f}".format(grand))

All outputs are formatted to 2 decimal places.

See attachment for sample run

Read more about similar programs at:

brainly.com/question/23954622

Answer 2
Answer:

Answer:

Explanation

If I were calculating a tip at a restaurant using the same syntax, it would have been. meal ... New value of meal is double meal times tax. you're saying: (meal + meal) * tax but meal + meal * tax is calculated in the following order meal + (meal * tax) ... eh? ;) The exercise implied it was just reading the equation from right to left.


Related Questions

#Imagine you're writing a program to check if a person is #available at a certain time. # #To do this, you want to write a function called #check_availability. check_availability will have two #parameters: a list of instances of the Meeting class, and #proposed_time, a particular date and time. # #check_availability should return True (meaning the person #is available) if there are no instances of Meeting that #conflict with the proposed_time. In other words, it should #return False if proposed_time is between the start_time and #end_time for any meeting in the list of meetings. # #The Meeting class is defined below. It has two attributes: #start_time and end_time. start_time is an instance of the #datetime class showing when the meeting starts, and #end_time is an instance of the datetime class indicating #when the meeting ends. # #Hint: Instances of the datetime have at least six #attributes: year, month, day, hour, minute, and second. # #Hint 2: Comparison operators work with instances of the #datetime class. time_1 < time_2 will be True if time_1 is #earlier than time_2, and False otherwise. # #You should not assume that the list is sorted. #Here is our definition of the Meeting class: from datetime import datetime class Meeting: def __init__(self, start_time, end_time): self.start_time = start_time self.end_time = end_time #Write your function here! #Below are some lines of code that will test your function. #You can change the value of the variable(s) to test your #function with different inputs. # #If your function works correctly, this will originally #print: True, then False meetings = [Meeting(datetime(2018, 8, 1, 9, 0, 0), datetime(2018, 8, 1, 11, 0, 0)), Meeting(datetime(2018, 8, 1, 15, 0, 0), datetime(2018, 8, 1, 16, 0, 0)), Meeting(datetime(2018, 8, 2, 9, 0, 0), datetime(2018, 8, 2, 10, 0, 0))] print(check_availability(meetings, datetime(2018, 8, 1, 12, 0, 0))) print(check_availability(meetings, datetime(2018, 8, 1, 10, 0, 0)))
You text file begins with the following rows. The pattern is a description of the item to be repaired, its color, and the issue. bike, red, flat tire bike, blue, broken chain skate, blue, loose wheel mitt, red, torn lace Your program starts with the following lines. import csv aFile = open("data\broken.txt","r") aReader = csv.reader(aFile) countRed = 0 for item in aReader: When you write code to count the number of times red is the color, what is the index of "red"?
Below is a 4-bit down-counter. What is the largest number of the counter if the initial state Q3Q2Q1Q0=0011? (D3 and Q3 are MSB, and when Load = 1 and Count =1 the counter is loaded with the value D3…D0) Selected Answer: IncorrectC. 1100 Answers: CorrectA. 1111 B. 0011 C. 1100 D. 0110
1. What is the difference between computer organization and computer architecture? 2. What is an ISA? 3. What is the importance of the Principle of Equivalence of Hardware and Software? 4. Name the three basic components of every computer. 5. To what power of 10 does the prefix giga- refer? What is the (approximate) equivalent power of 2? 6. To what power of 10 does the prefix micro- refer? What is the (approximate) equivalent power of 2?
Your app needs to store the following information. For each type of information, decide whether you would use an array or a variable to store it:(a) All the messages a user has sent(b) The highest score a user has ever reached on the app(c) A username and password to unlock the app

Write a program that asks the user to enter the size of a triangle (an integer from 1 to 50). Display the triangle by writing lines of asterisks. The first line will have one asterisk, the next two, and so on, with each line having one more asterisk than the previous line, up to the number entered by the user. On the next line write one fewer asterisk and continue by decreasing the number of asterisks by 1 for each successive line until only one asterisk is displayed. (Hint: Use nested for loops; the outside loop controls the number of lines to write, and the inside loop controls the number of asterisks to display on a line.) For example, if the user enters 3, the output would be:_______.a. *b. **c. ***d. **e. *

Answers

Answer:

Implemented using Python

n = int(input("Sides: "))

if(n>=1 and n <=50):

    for i in range(1,n+1):

         for j in range(1,i+1):

              print('*',end='')

         print("")

       

    for i in range(n,0,-1):

         for j in range(i,1,-1):

              print('*',end='')

         print("")

else:

         print("Range must be within 1 and 50")

Explanation:

This line prompts user for number of sides

n = int(input("Sides: "))

The line validates user input for 1 to 50

if(n>=1 and n <=50):

The following iteration uses nested loop to print * in ascending order

   for i in range(1,n+1):

         for j in range(1,i+1):

              print('*',end='')

         print("")

The following iteration uses nested loop to print * in descending order        

    for i in range(n,0,-1):

         for j in range(i,1,-1):

              print('*',end='')

         print("")

The following is executed if user input is outside 1 and 50

else:

         print("Range must be within 1 and 50")

Jimmy Fallon's persona when he is outside the White House can best be characterized as:A. humble and excited.
B. outrageous and crazy.
C. stern and authoritative.
D. dark and serious.

Answers

B) outrageous and crazy
The answer to your question is b

Most slide layouts include at least one ________ by default.Question 2 options:

placeholder

action button

transition

animation

Answers

Hey

I think that the answer placeholder :)

Sry if im wrong tho

Answer:

The answer is placeholder.

Write an Enlistee class that keeps data attributes for the following pieces of information: • Enlistee name • Enlistee number Next, write a class named Private that is a subclass of the Enlistee class. The Private class should keep data attributes for the following information: • Platoon number (an integer, such as 1, 2, or 3) • Years of service (also an integer)

Answers

Answer:

function Enlistee( name, number ){

    constructor( ){

      super( ) ;

      this.name= name;

      this.number= number;

      this.Private= ( platoonNumber, yearOfService ) =>{

                             this.platoonNumber = platoonNumber;

                             this.yearOfService = yearOfService;

                             }

     }

}                

Explanation:

In Javascript, OOP ( object-oriented programming) just like in other object oriented programming languages, is used to create instance of a class object, which is a blueprint for a data structure.

Above is a class object called Enlistee and subclass "Private" with holds data of comrades enlisting in the military.

The section on the Publisher screen that allows you to quickly move from one page another in a publication is the _____. View tabPage pane

Page Design tab

Zoom bar

Answers

Answer:

Page pane

Explanation:

This pane is present under the navigation pane, it allow to hop easily from one page to other.  Moreover pages can be added using Add Page button.

Page pane makes the view and navigation from on page to another easier and quicker.

Write a program that accepts a four digit number, such as 1998, and displays it on number on a line, like: 1 9 9 8 The program should prompt for a four digit number. The program assumes that the user enters the correct information. Provide the java code, including a comment with your name, course code and date.

Answers

package brainly;

import java.util.*;

/**

*

* @author CotrinaAlejandra

*/

public class Brainly {

   /*Provide the java code, including a comment with your name, course code and date.

   Name:  

   Course:  

   Date: */

   public static void main(String[] args) {

       // TODO code application logic here

       int number;

       Scanner sc = new Scanner(System.in);

       System.out.print("Write a four digit number: ");

       number=sc.nextInt();

       String newLine= String.valueOf(number);

       System.out.println(newLine.charAt(0)+"  "+newLine.charAt(1)+"  "+newLine.charAt(2)+"  "+newLine.charAt(3));

       

       

   }

   

}