Placeholder

CS192 Programming Essentials – Week 4 Assignment

$9.00

Description

Modify the week 3 program assignment to do the following in order:
1.    Ask the user to enter a name or ‘q’ to quit
2.    While the user has not entered ‘q’ ask the user to enter an amount “account balance”
3.    Ask the user to enter a number “amount”
4.    If the amount is positive, calculate the “new account balance” by adding the amount and the account balance, print out the new account balance
5.    If the amount is negative, calculate the “new account balance” by subtracting the amount from the account balance, print out “Account is overdrawn” and the new account balance
6.    When the user enters ‘q’, quit the program. The program should continue to prompt the user to enter a name until the user enters ‘q’.
7.    Round all numeric outputs to 2 decimal places.
An example of the program’s input and output is shown below:
Enter your name or ‘q’ to quit: Belinda Patton
Enter an amount your account balance: 56.61
Enter amount to withdraw (-) or deposit (+): 25
Your account balance is $81.61
Enter your name or ‘q’ to quit: Belinda Patton
Enter an amount your account balance: 23.61
Enter amount to withdraw (-) or deposit (+): -25
Your account balance is $-1.39
Enter your name or ‘q’ to quit: Belinda Patton
Enter an amount for your account balance: 33
Enter amount to withdraw (-) or deposit (+): -33
Your account balance is zero
Enter your name or ‘q’ to quit: q
Exiting Program
SCREENSHOTS
SOLUTION
PAYMENT
The solution consists of:
A report word document for this assignment
All Python programs in case you want to run theses programs on your computer.
Screenshots while running programs
Attachments [Move over files to preview content of those files]
CS192_WEEK_4.zip (132.05 KB)
CS192-Week-4-Screenshot-1.png
CS192_Week4_Report.docx
Pycharm Project
CS192Week4
.idea
.gitignore
CS192Week4.iml
inspectionProfiles
profiles_settings.xml
misc.xml
modules.xml
workspace.xml
week4.py
Python code
week4.py
Preview week4.py
xx __xxxx__ == ‘__xxxx__’:
xxxxx xxxx:
# 1. xxx xxx xxxx xx xxxxx x xxxx xx ‘x’ xx xxxx
xxxx = xxxxx(‘xxxxx xxxx xxxx xx ‘x’ xx xxxx: ‘)
xx xxxx == ‘x’:
break # ask the user to enter an amount “account balance” balance = float(input(‘Enter an amount your account balance: ‘)) # Ask the user to enter a number “amount” amount = float(input(‘Enter amount to withdraw(-) or deposit(+): ‘)) # calculate new account balance new_balance = balance + amount
xxx_xxxxxxx = xxxxx(xxx_xxxxxxx, 2) # xxxxx xxx xxxxxxx xxxxxxx xx 2 xxxxxxx xxxxxx
xx xxx_xxxxxxx > 0:
xxxxx (‘xxxx xxxxxxx xxxxxxx xx $%x’ % xxx_xxxxxxx)
xxxx xxx_xxxxxxx == 0:
xxxxx (‘xxxx xxxxxxx xxxxxxx xx xxxx’)
xxxx:
Preview week4.py
xx __xxxx__ == ‘__xxxx__’:
xxxxx xxxx:
# 1. xxx xxx xxxx xx xxxxx x xxxx xx ‘x’ xx xxxx
xxxx = xxxxx(‘xxxxx xxxx xxxx xx ‘x’ xx xxxx: ‘)
xx xxxx == ‘x’:
break # ask the user to enter an amount “account balance” balance = float(input(‘Enter an amount your account balance: ‘)) # Ask the user to enter a number “amount” amount = float(input(‘Enter amount to withdraw(-) or deposit(+): ‘)) # calculate new account balance new_balance = balance + amount
xxx_xxxxxxx = xxxxx(xxx_xxxxxxx, 2) # xxxxx xxx xxxxxxx xxxxxxx xx 2 xxxxxxx xxxxxx
xx xxx_xxxxxxx > 0:
xxxxx (‘xxxx xxxxxxx xxxxxxx xx $%x’ % xxx_xxxxxxx)
xxxx xxx_xxxxxxx == 0:
xxxxx (‘xxxx xxxxxxx xxxxxxx xx xxxx’)
xxxx:
Price: $19
You May Also Like:
CS192 Programming Essentials – Week 1 Assignment
CS192 Programming Essentials – Week 2 Assignment
CS192 Programming Essentials – Week 3 Assignment
CS192 Programming Essentials – Week 5 Assignment
CS192 Programming Essentials – Week 6 Assignment
CS192 Programming Essentials – Week 7 Assignment
CS192 Programming Essentials – Week 8 Assignment

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.