Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a python program that runs only on the command-line prompt. i.e. if you run this program on IDEL it would give you an error

Write a python program that runs only on the command-line prompt. i.e. if you run this program on IDEL it would give you an error message. Name the program buy.py. Assume that this program is used by a departmental store to calculate your total price if you want to buy an extended warranty for your purchased Computer. The program takes two arguments at the command-line prompt: 1) the computers brand name, and 2) the price of the computer that you are buying. The user enters these arguments at the command-line prompt as shown below. The program will display the choice of the buyer and the price on the screen and asks the user if she/he want to buy an extended warranty. Then calculate the Total price and print it on the screen. Write the program according to the given examples of the program runs as shown below.

C:\Users\UserName>python buy.py Dell 1200

You are buying a Dell computer for $1200

Do you like to buy an extended warranty yes/no ? no

Total price : $1200

C:\Users\UserName>python buy.py Dell 1200

You are buying a Dell computer for $1200

Do you like to buy an extended warranty yes/no ? yes

1- $20 for 1 year plan

2- $30 for 2 years plan

Which plan you like 1 or 2 ? 1

Total price : $1220

C:\Users\UserName>python buy.py Dell 1200

You are buying a Dell computer for $1200

Do you like to buy an extended warranty yes/no ? yes

1- $20 for 1 year plan

2- $30 for 2 years plan

Which plan you like 1 or 2 ? 2

Total price : $1230

C:\Users\UserName>python buy.py Dell 1200

You are buying a Dell computer for $1200

Do you like to buy an extended warranty yes/no ? yesno

Invalid choice

C:\Users\UserName>python buy.py Dell 1200

You are buying a Dell computer for $1200

Do you like to buy an extended warranty yes/no ? yes

1- $20 for 1 year plan

2- $30 for 2 years plan

Which plan you like 1 or 2 ? 33

Invalid choice

Continue next page

Note:

  • You can run the program from any directory that is convenient for you. You dont have to use the exact directory that is shown in the examples.
  • Assume that the user enters the exact number and type of arguments.
  • Your program should work exactly as described in the examples.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions

Question

Solve the equations and inequalities in Problems 715. x = 4x + 5

Answered: 1 week ago

Question

1. Outline the listening process and styles of listening

Answered: 1 week ago

Question

4. Explain key barriers to competent intercultural communication

Answered: 1 week ago