Placeholder

CS192 Programming Essentials – Week 3 Assignment

$9.00

Description

Write a program that does the following in order:
1.     Ask user to enter a name
2.     Ask the user to enter five numbers “amount1”, “amount2”, “amount3”, “amount4”, “amount5”
3.     Calculate the sum of the numbers “amount1”, “amount2”, “amount3”, “amount4”, “amount5”
4.     If the sum is greater than 0, print out the sum
5.     If the sum is equal to zero, print out “Your account balance is zero”
6.     If the sum is less than 0, print out “Your account is overdrawn” and the “negative amount”
7.     Round all print values to 1 decimal place
Examples of the program’s inputs and outputs are shown below:
Enter your name: Belinda Patton
Enter your amount 1: 52
Enter your amount 2: 2
Enter your amount 3: -22
Enter your amount 4: 12
Enter your amount 5: 32
Your account balance is $76.0
Enter your name: Belinda Patton
Enter your amount 1: -52
Enter your amount 2: 2
Enter your amount 3: 22
Enter your amount 4: 12
Enter your amount 5: 28
Your account balance is zero.
Enter your name: Belinda Patton
Enter your amount 1: -52
Enter your amount 2: 2
Enter your amount 3: -22
Enter your amount 4: 12
Enter your amount 5: -32
Your account is overdrawn. The overdrawn amount is -$92.0
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_3.zip (207.58 KB)
CS192-Week-3-Screenshot-1.png
CS192-Week-3-Screenshot-2.png
CS192-Week-3-Screenshot-3.png
CS192_Week3_Report.docx
Pycharm Project
CS192Week3
.idea
.gitignore
CS192Week3.iml
inspectionProfiles
profiles_settings.xml
misc.xml
modules.xml
workspace.xml
week3.py
Python code
week3.py
Preview week3.py
xx __xxxx__ == ‘__xxxx__’:
# 1. xxx xxxx xx xxxxx x xxxx
xxxx = xxxxx(‘xxxxx xxxx xxxx: ‘)
# 2. xxx xxx xxxx xx xxxxx xxxx xxxxxxx “xxxxxx1”, “xxxxxx2”, “xxxxxx3”, “xxxxxx4”, “xxxxxx5”
xxxxxx_xxxxx = []
for idx in range(1, 6): amount = float(input(‘Enter your amount%s: ‘ % idx)) amount_array.append(amount) # 3. Calculate the sum of the numbers “amount1”, “amount2”, “amount3”, “amount4”, “amount5” s = sum(amount_array) s = round(s, 1) # 7. Round all print values to 1 decimal place # 4. If the sum is greater than 0, print out the sum
xx x > 0:
xxxxx (‘xxxx xxxxxxx xxxxxxx xx $%x’ % x)
# 5. xx xxx xxx xx xxxxx xx xxxx, xxxxx xxx “xxxx xxxxxxx xxxxxxx xx xxxx”
xxxx x == 0:
xxxxx (‘xxxx xxxxxxx xxxxxxx xx xxxx’)
# 6. xx xxx xxx xx xxxx xxxx 0, xxxxx xxx “xxxx xxxxxxx xx xxxxxxxxx” xxx xxx “xxxxxxxx xxxxxx”
Preview week3.py
xx __xxxx__ == ‘__xxxx__’:
# 1. xxx xxxx xx xxxxx x xxxx
xxxx = xxxxx(‘xxxxx xxxx xxxx: ‘)
# 2. xxx xxx xxxx xx xxxxx xxxx xxxxxxx “xxxxxx1”, “xxxxxx2”, “xxxxxx3”, “xxxxxx4”, “xxxxxx5”
xxxxxx_xxxxx = []
for idx in range(1, 6): amount = float(input(‘Enter your amount%s: ‘ % idx)) amount_array.append(amount) # 3. Calculate the sum of the numbers “amount1”, “amount2”, “amount3”, “amount4”, “amount5” s = sum(amount_array) s = round(s, 1) # 7. Round all print values to 1 decimal place # 4. If the sum is greater than 0, print out the sum
xx x > 0:
xxxxx (‘xxxx xxxxxxx xxxxxxx xx $%x’ % x)
# 5. xx xxx xxx xx xxxxx xx xxxx, xxxxx xxx “xxxx xxxxxxx xxxxxxx xx xxxx”
xxxx x == 0:
xxxxx (‘xxxx xxxxxxx xxxxxxx xx xxxx’)
# 6. xx xxx xxx xx xxxx xxxx 0, xxxxx xxx “xxxx xxxxxxx xx xxxxxxxxx” xxx xxx “xxxxxxxx xxxxxx”
Price: $19
You May Also Like:
CS192 Programming Essentials – Week 1 Assignment
CS192 Programming Essentials – Week 2 Assignment
CS192 Programming Essentials – Week 4 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.