Answered step by step
Verified Expert Solution
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 computer's 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 yeso ? 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 yeso ? 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 yeso ? 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 yeso ? 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 yeso ? 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 don't 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started