Question

Write a program that does the following in order: 1. Ask user to enter a name...

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

Round your sum output to 2 decimal places.

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.00

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.00

Homework Answers

Answer #1
#I am using python for this program.

# This will input the name of the program.
name = str(input('Enter your Name:')) 
# Input amount_1.
amount_1 = int(input('Enter your amount 1:'))
# Input amount_2.
amount_2 = int(input('Enter your amount 2:'))
# Input amount_3.
amount_3 = int(input('Enter your amount 3:'))
# Input amount_4.
amount_4 = int(input('Enter your amount 4:'))
# Input amount_5.
amount_5 = int(input('Enter your amount 5:'))
# sum of all the amounts.
sum = amount_1 + amount_2 + amount_3 + amount_4 + amount_5
if sum > 0:
  # printing the sum with 2 decimal places.
  print('Your Account balance is ${:0.2f}'.format(sum))
if sum == 0:
  print('Your Account balance is zero.')
if sum < 0:
  print('Your account is overdrawn. The overdrawn amount is ${:0.2f}'.format(float(sum)))

I have added the code snippet and a screenshot of the executed program. If you have any doubts please let me know. If you like the answer please let me know.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1)Write a program that asks a user for a number. If (and only if) the number...
1)Write a program that asks a user for a number. If (and only if) the number is greater than zero print “The number is valid” 2)Write a program that asks a user for a grade. If (and only if) the grade is greater than zero and less than 101, print “The grade is valid” 3)Write a program that asks a user how many widgets they want to buy and prints out what the user should pay. Widgets costs 10 dollars....
Use C++ Write a program that first reads in how many whole numbers the user wants...
Use C++ Write a program that first reads in how many whole numbers the user wants to sum, then reads in that many whole numbers, and finally outputs the sum of all the numbers greater than zero, the sum of all the numbers less than zero (which will be a negative number or zero), and the sum of all the numbers, whether positive, negative, or zero. The user enters the numbers just once each and the user can enter them...
Write a program that prompts the user to enter an integer number between 1 and 999....
Write a program that prompts the user to enter an integer number between 1 and 999. The program displays the sum of all digits in the integer if the input is valid; otherwise, it displays a message indicating that the integer is not between 1 and 999 and hence, is invalid. Name the program file Q1.cpp Example: if the user enters 12, sum of digits is 3. If the user enters 122, sum of digits is 5.
(8 marks) Write a program to ask user to input an integer and display the special...
Write a program to ask user to input an integer and display the special pattern accordingly. REQUIREMENTS The user input is always correct (input verification is not required). Your code must use loop statements (for, while or do-while). Your program should use only the following 3 output statements, one of EACH of the followings: System.out.print("-"); // print # System.out.print("+"); // print + System.out.println(); // print a newline Your code must work exactly like the following example (the text in bold...
in c++ Write a C++ program that asks the user to enter an integer number and...
in c++ Write a C++ program that asks the user to enter an integer number and prints it back "vertically" to the screen. Use recursion in your solution. As an example of how the program will work: Please enter an integer: 12345 The integer you entered will print vertically as: 1 2 3 4 5
Write a Python program that will ask the user to enter the masses of two particles...
Write a Python program that will ask the user to enter the masses of two particles (particle one and particle two) and particle 1’s initial velocity (v1). Assume particle two is at rest. The program should calculate the scattering angle and velocity for particle 2 as a function of the scattering angle and resulting velocity of particle 1
x86 irvine library assembly code Write a complete program that: 1. Prompt the user to enter...
x86 irvine library assembly code Write a complete program that: 1. Prompt the user to enter 10 numbers. 2. save those numbers in a 32-bit integer array. 3. Print the array with the same order it was entered. 3. Calculate the sum of the numbers and display it. 4. Calculate the mean of the array and display it. 5. Rotate the members in the array forward one position for 9 times. so the last rotation will display the array in...
Please use Python 3 4). Write a program that asks the user to enter 10 numbers....
Please use Python 3 4). Write a program that asks the user to enter 10 numbers. The program should store the numbers in a list and then display the following data: • The lowest number in the list • The highest number in the list •The total of the numbers in the list • The average of the numbers in the list   Sample input & output: (Prompt) Enter Number 1: (User enter) 4 (Prompt) Enter Number 2: (User enter) 7...
PROGRAM PYHTON Write a function called "calculateInput" that when called, it asks the user to enter...
PROGRAM PYHTON Write a function called "calculateInput" that when called, it asks the user to enter an number. Then, it asks for a second number. These will use the "input" command. Store these as two separate variables. This function takes NO arguments and is also a VOID function, there is no return statement. The function should print the result of these two numbers multiplied together. The program should be able to multiply floats. For example: Test Input Result calculateInput() 5...
Question: Write a C++ program to ask the user to give you the number of rows...
Question: Write a C++ program to ask the user to give you the number of rows and number of columns, then make the multiplication table by using nested loop. For example, if the user enters 3 for rows and 4 for columns then the multiplication table would be like the following: 1    2   3     4 1   1 2 3 4 2   2    4      6    8 3    3 6 9 12
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT