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 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:
import sys
args = sys.argv
name = args[1]
price = float(args[2])
total=price
print('You are buying a {:} computer for ${:}'.format(name,price))
extend=input('Do you like to buy an extended warranty yes/no ?')
if extend == 'no':
print('Total price : ${:}'.format(total))
elif extend=='yes':
print('1- $20 for 1 year plan\n2- $30 for 2 years plan')
plan=int(input('Which plan you like 1 or 2 ? '))
if plan == 1:
total+=20
print('Total price : ${:}'.format(total))
elif plan == 2:
total+=30
print('Total price : ${:}'.format(total))
else:
print('Invalid choice')
else:
print('Invalid choice')

Write a python program that runs only on the command-line prompt. i.e. if you run this...
How do I do the following on a Unix Command Line Prompt: Change you command-line prompt to some interesting phrase/word of your choice Change the command-line prompt to display your user name and your current working directory (this includes your interesting phrase/word) Create a short alias for “ls -l -a”, it is up to you, but maybe “lsa” Execute the “who” command together with the “grep” command to identify whether your peer group (or any 3 or more people) are...
Write this program using python. In your program, when you prompt users for values, only prompt them to enter one value at a time. Here is a sample of what your program should look like. Sample Program Run (User input in bold) What is the length of the room (in feet)? 50 What is the width of the room (in feet)? 30 What is the length of the table (in feet)? 8 What is the width of the table (in...
Command line input In C++ it is possible to accept command line arguments. Command-line arguments are given after the name of a program in command-line operating systems like Linux and are passed in to the program from the operating system. To use command line arguments in the program, it must first understand the full declaration of the main function, which until now has accepted no arguments. In fact, main can accept two arguments: one argument is number of command line...
Write a Python (3) program to simulate** a buffer overflow (this is a new script, not part of the intranet assignment), then implement input validation to prevent it. There are two parts to this assignment: 1) The program should display a welcome message and prompt the user for a username. Create a simulated buffer overflow condition by allowing a user to input more data than the size of the allocated memory (causing the program to crash). 2) Implement input validation...
1. Give the command (single command or pipelined series of commands) that performs each of the following tasks. Assume bash, and the commands we have been discussing. Do not use things like perl, awk, python, etc. Unless specifically stated otherwise, assume that the command should work no matter what your current working directory is or where a user's home directory is located. Use only flags that are required by the question as stated. Assume you are logged in as a "normal" (non-administrator) user,...
Design and implement a simple, interactive shell program that prompt the user for a command, parser the command (you do not need to write a parser) and then execute it. The commands are: attrib file. To make the file read only. copy fileA fileB To copy fileA into fileB. delete file To delete the file. dir name or just dir The listing of the directory name is displayed. In case of just dir, the list of the items in the current...
Your task is to write a C++ program that consumes integer values as command line arguments and returns the arithmetic mean of these values. To increase the flexibility of the program, there should be no set number of arguments. To overcome this, we will require the argument argv[1] to be the number of integers the user enters. For example, if the user wants to calculate the arithmetic mean of 4 numbers, they would pass in 4 as the first argument...
Write a Python program that reads user input from the command-line. The program should define a function read Position, which reads the values for t, v0, and h0. If there is an IndexError, print 'Please provide the values for t, vO, and hO on the command line.'. If t, v0, or h0 are less than 0. print 't = # is not possible.' for each variable respectively. Note that the # represents the number entered on the command-line by the...
You will be making a program that can take command like args. Using command line arguments, allow the program to do the following If the command is -i, print: Integer, and then print the integer after it. If the command is -f print: float, and then print the float after it if the command is -s print: string, and then print the string after it. If the command is -h print: all the commands, and the syntax If the command...
Step 3: How would you write this script in C? It needs to do the
things required in step 3.
1. You have received a new batch of distinguished users; their basic information is located in newusers.tar. Inside of the tar file, there is a file called "newusers.txt" which contains a colon-separated entry for each user: the username, the uid, the GECOS information, and the user's preferred shell. Also in the tar file you will find a public key for...