Selling a new vehicle pays a salesperson $1500. Selling a used vehicle pays a commission of 5% of the selling price. Write an interactive program that calculates a salesperson's total pay for selling two vehicles, each one of any type. The program should prompt the salesperson to enter the type and selling price of each vehicle. Do not use a loop. The program should then display the salesperson's total sales and total pay. Express these amounts in currency format as described in the requirements above.

Question
Asked Dec 2, 2019
12 views

Selling a new vehicle pays a salesperson $1500. Selling a used vehicle pays a commission of 5% of the selling price. Write an interactive program that calculates a salesperson's total pay for selling two vehicles, each one of any type. The program should prompt the salesperson to enter the type and selling price of each vehicle. Do not use a loop. The program should then display the salesperson's total sales and total pay. Express these amounts in currency format as described in the requirements above.

check_circle

Expert Answer

Step 1

To perform this without loop.

  • This program used repeatative input asked by user.
  • Caclulation also used repeatative .
Step 2

Program:

#taking input from user

type=input("Enter the type of vehicle.\nType \"new\" for new vehicle and \"old\" for old vehicle: ")

#taking input from user

sellPrice=float(input("enter the selling price of vehicle: "))

pays=0

count=0

#if statement

if(type=="new"):

  count=count+1

  pays=pays+1500

#elif statement

elif(type=="old"):

  count=count+1

  pays=pays+(sellPrice*0.05)

type=input("Enter the type of vehicle.\nType \"new\" for new vehicle and \"old\" for old vehicle: ")

#taking input...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Python

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add
question_answer

Q: What is polymorphism?

A: Polymorphism: The word polymorphism means multiple types. Simply, polymorphism can be characterized ...

question_answer

Q: Write a python program and solve the problem. Selling a new vehicle pays a salesperson $1800. Sellin...

A: Program Instructions:Prompt the user to enter type and selling price of 2 vehicles. One must be old ...

question_answer

Q: Let Z = {a, b, c, d}. What is the cardinality of the Power Set of Z, |P(Z)|?

A: Cardinality denotes to the Number of Elements in a Finite set and Power set of Z.It represents all t...

question_answer

Q: Can you think about situations where default values will improve data integrity, and situations wher...

A: Default values:Default values are used to avoid errors where there is no entry.Default values are va...

question_answer

Q: Define a function named get_yes_or_no that consumes a string containing thequestion to which the use...

A: Program code:

question_answer

Q: d. Explain the steps of the fetch-decode-execute cycle. Your explanation should include what is happ...

A: A program consists of collections of instructions encoded using the method of binary numbers. The fe...

question_answer

Q: Define the missing function. licenseNum is created as: (100000 * customID) + licenseYear, where cust...

A: The complete C++ code and the missing function are given below:

question_answer

Q: Write a program in python w/ no imports that the owner of Chica Chic could use to store data about h...

A: Open a file called inventory.txtThe file inventory.txt has the name of an inventory, cost, and quant...

question_answer

Q: If you wanted to apply an exception for the current subnet, what would you type?

A: Explanation:The user can type the following on linux to apply exception for the current subnet,defau...