Question

USE PYTHON. Notice that the output needs to be as it is required. 4.18 LAB*: Program:...

USE PYTHON. Notice that the output needs to be as it is required.

4.18 LAB*: Program: Automobile service invoice

(1) Output a menu of automotive services and the corresponding cost of each service. (2 pts)

Ex:

Davy's auto shop services
Oil change -- $35
Tire rotation -- $19
Car wash -- $7
Car wax -- $12


(2) Prompt the user for two services from the menu. (2 pts)

Ex:

Select first service:
Oil change
Select second service:
Car wax


(3) Output an invoice for the services selected. Output the cost for each service and the total cost. (3 pts)

Davy's auto shop invoice

Service 1: Oil change, $35
Service 2: Car wax, $12

Total: $47


(4) Extend the program to allow the user to enter a dash (-), which indicates no service. (3 pts)

Ex:

Davy's auto shop services
Oil change -- $35
Tire rotation -- $19
Car wash -- $7
Car wax -- $12

Select first service:
Tire rotation
Select second service:
-

Davy's auto shop invoice

Service 1: Tire rotation, $19
Service 2: No service

Total: $19

Homework Answers

Answer #1
def automotive_service():
    print("To select service from the menu type service name. If you don't want to select any service you can enter -.");
    service1 = input("Select first service: ").lower();
    service2 = input("Select second service: ").lower();

    if service1 not in services.keys() or service2 not in services.keys():
        print("Please enter valid service from menu")
        automotive_service()
    else:
        if service1 == '-':
            print('Service 1: No service');
        else:
            print('Service 1: ' + service1 + ', $' + services[service1]);
        if service2 == '-':
            print('Service 2: No service');
        else:
            print('Service 2: ' + service2 + ', $' + services[service2]);
        total = int(services[service1]) + int(services[service2])
        print("Total: $" + str(total));


if __name__ == '__main__':
    print("Davy'a auto shop services");
    print("Oil change -- $35 \nTire rotation -- $19 \nCar wash -- $7 \nCar wax -- $12");

    services = {
        'oil change': '35',
        'tire rotation': '19',
        'car wash': '7',
        'car wax': '12',
        '-': '0'
    }

    automotive_service()

If you like the answer please don't forget to upvote. Thank you Stay safe

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
5.27 LAB*: Program: Soccer team roster (Vectors) This program will store roster and rating information for...
5.27 LAB*: Program: Soccer team roster (Vectors) This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balanced team. (1) Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jersey numbers in one int vector and the ratings in another int vector. Output these vectors (i.e., output the roster). (3 pts) Ex: Enter player...
PLEASE POST IN C++ : Thank you!! 5.27 LAB*: Program: Soccer team roster (Vectors) This program...
PLEASE POST IN C++ : Thank you!! 5.27 LAB*: Program: Soccer team roster (Vectors) This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balanced team. (1) Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jersey numbers in one int vector and the ratings in another int vector. Output these vectors (i.e., output...
USE PYTHON Please!!! 4.15 LAB: Exact change Write a program with total change amount as an...
USE PYTHON Please!!! 4.15 LAB: Exact change Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is: 0 (or less than 0), the output is: No change Ex: If the input is: 45 the output is: 1...
USING C++ The purpose of this assignment is the use of 2-dimensional arrays, reading and writing...
USING C++ The purpose of this assignment is the use of 2-dimensional arrays, reading and writing text files, writing functions, and program planning and development. You will read a data file and store all of the input data in a two dimensional array. You will perform calculations on the data and store the results in the 2 dimensional array. You will sort the array and print the results in a report. Instructions You will read in the same input file...
Question 1 2.5 pts 1. The perfectly competitive firm's demand curve is horizontal at the market...
Question 1 2.5 pts 1. The perfectly competitive firm's demand curve is horizontal at the market price. True False Flag this Question Question 2 2.5 pts 2. In perfect competition, the market price is established at the intersection of the market demand and market supply curves in the industry and the individual firms are "price takers" of that market price. True False Flag this Question Question 3 2.5 pts 3. The perfectly competitive firm will continue to produce in the...
The following statement is true is all respects: Organizations that make up the supply chain are...
The following statement is true is all respects: Organizations that make up the supply chain are “linked” together through physical, financial and information flows forming partnerships that add value to the customer experience. True False Flag this Question Question 3 1 pts Supply chain management is undergoing a level of transformation, not unlike other disciplines. Which of the selections below best represents this transformation. Business Logistics Physical Distribution Integrated Business Planning Its not transforming Flag this Question Question 4 1...
I completed everything except for the last part. I know my answers are right because i...
I completed everything except for the last part. I know my answers are right because i double checked but i just dont know how to answer the last section. Problem 3-1 Schedule C (LO 3.1) Scott Butterfield is self-employed as a CPA. He uses the cash method of accounting, and his Social Security number is 644-47-7833. His principal business code is 541211. Scott's CPA practice is located at 678 Third Street, Riverside, CA 92860. Scott’s income statement for the year...
Score for this attempt: 69 out of 75 Submitted Apr 10 at 10:59am This attempt took...
Score for this attempt: 69 out of 75 Submitted Apr 10 at 10:59am This attempt took 74 minutes. Question 1 1.5 / 1.5 pts Process manufacturing usually reflects a manufacturer that produces small quantities of unique items.    True Correct!   False Question 2 1.5 / 1.5 pts On a common-sized income statement, all items are stated as a percent of total assets or equities at year-end. Correct!   False     True Question 3 1.5 / 1.5 pts A single plantwide overhead...
Muffler Magic* Muffler Magic is a fast-growing chain of 25 automobile service centers in Nevada. Originally...
Muffler Magic* Muffler Magic is a fast-growing chain of 25 automobile service centers in Nevada. Originally started 20 years ago as a muffler repair shop by Ronald Brown, the chain expanded rapidly to new locations, and as it did so Muffler Magic also expanded the services it provided, from muffler replacement to oil changes, brake jobs, and engine repair. Today, one can bring an automobile to a Muffler Magic shop for basically any type of service, from tires to mufflers...
Code Example 8-1 1. int count = 1; 2. int item_total = 0; 3. int item...
Code Example 8-1 1. int count = 1; 2. int item_total = 0; 3. int item = 0; 4. while (count < 4) { 5.      cout << "Enter item cost: "; 6.      cin >> item; 7.      item_total += item; 8.      ++count; 9. } 10. int average_cost = round(item_total / count); 11. cout << "Total cost: " << item_total << "\nAverage cost: " << average_cost; (Refer to Code Example 8-1.) If the user enters 5, 10, and 15 at the prompts, the output is: Total...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT