The complete Python program to calculate the monthly payment on a loan with step by step explanation is given below.
Python Code with Explanation:
# get the loan amount from the user
LoanAmt=eval(input("Please enter the loan amount: "))
# get the annual interest rate from the user in percentage form
InterestRate=eval(input("Please enter the annual interest rate in percentage: "))
# get the number of months from the user
NumberMonths=eval(input("Please enter the number of months: "))
# convert the annual interest rate into monthly interest rate and also into decimal form according to the equation given in the question
MonthlyRate = InterestRate/1200
# implement the given equation to find out the required monthly payment, the operator (**) is used to raise to the power
Payment = (LoanAmt*MonthlyRate (1+MonthlyRate)**NumberMonths)/((1+MonthlyRate)**NumberMonths -1)
# finally, print the monthly payment
print("The monthly payment is: ", Payment)
Output:
Please enter the loan amount: 1500
Please enter the annual interest rate in percentage: 15
Please enter the number of months: 12
The monthly payment is: 135.38746851773584
Bonus:
You can use this command to limit the digits after the decimal point
For example following code will limit to 2 digits after the decimal point.
print(format(Payment, '.2f'))
The complete Python program to calculate the monthly payment on a loan with step by step explanation is given below.
Python Code with Explanation:
# get the loan amount from the user
LoanAmt=eval(input("Please enter the loan amount: "))
# get the annual interest rate from the user in percentage form
InterestRate=eval(input("Please enter the annual interest rate in percentage: "))
# get the number of months from the user
NumberMonths=eval(input("Please enter the number of months: "))
# convert the annual interest rate into monthly interest rate and also into decimal form according to the equation given in the question
MonthlyRate = InterestRate/1200
# implement the given equation to find out the required monthly payment, the operator (**) is used to raise to the power
Payment = (LoanAmt*MonthlyRate (1+MonthlyRate)**NumberMonths)/((1+MonthlyRate)**NumberMonths -1)
# finally, print the monthly payment
print("The monthly payment is: ", Payment)
Output:
Please enter the loan amount: 1500
Please enter the annual interest rate in percentage: 15
Please enter the number of months: 12
The monthly payment is: 135.38746851773584
Bonus:
You can use this command to limit the digits after the decimal point
For example following code will limit to 2 digits after the decimal point.
print(format(Payment, '.2f'))
Save: $7,366.1
=> Enough to visit Spain in August
Step-by-step explanation:
Semi monthly salary is: $2770.22/2 = $1385.11
- Semi-monthly payment for Social Security is: $1385.11 x 6.2% = $85.88
=> 7-month payment for Social Security is: $85.88 x 14 = $1,202.32
- Semi-monthly payment for Medicare is: $1385.11 x 1.45% = $20.08
=> 7-month payment for Medicare is: $20.08 x 14 = $281.12
- 7-month expenses are: $1,200 x 7 = $8,400
- 7-month payment for State taxes is: $52 x 14 =$728
- 7-month payment for Federal taxes is: $101 x 14 =$1,414
=> Total expenditure in 7 months: 1,202.32 + 281.12 + 8,400 + 728 + 1,414 = $12,025.44
Total salary in 7 months: $2770.22 x 7 = $19,391.54
=> Total saving in 7 months: 19,391.54 - 12,025.44 = $7,366.1
=> ENough to visit SPain in August
$7,366.10; yes
Step-by-step explanation:
Save: $7,366.1
=> Enough to visit Spain in August
Step-by-step explanation:
Semi monthly salary is: $2770.22/2 = $1385.11
- Semi-monthly payment for Social Security is: $1385.11 x 6.2% = $85.88
=> 7-month payment for Social Security is: $85.88 x 14 = $1,202.32
- Semi-monthly payment for Medicare is: $1385.11 x 1.45% = $20.08
=> 7-month payment for Medicare is: $20.08 x 14 = $281.12
- 7-month expenses are: $1,200 x 7 = $8,400
- 7-month payment for State taxes is: $52 x 14 =$728
- 7-month payment for Federal taxes is: $101 x 14 =$1,414
=> Total expenditure in 7 months: 1,202.32 + 281.12 + 8,400 + 728 + 1,414 = $12,025.44
Total salary in 7 months: $2770.22 x 7 = $19,391.54
=> Total saving in 7 months: 19,391.54 - 12,025.44 = $7,366.1
=> ENough to visit SPain in August
To answer this question, i prepared a pseudocode and a program written in python;
Pseudocode begins here:
1.Start
2.Input montlySales
3.If monthlySales < 100000
3.1.Display Nothing
4.Else
4.1Display “You earned a $5000 bonus!”
4.2If monthlySales > 1.25 * 90000
4.2.1Display “All employees get one day off!”
5. Stop
Python Program starts here (See attachment for proper view of the program):
#Prompt user for input
monthlySales = float(input("Monthly Sales: "))
#Check monthlySales
if monthlySales < 100000:
print("")
else:
print("You earned a $5,000 bonus")
if monthlySales > 1.25 * 90000:
print("All Employees get the day off")
Explanation:
To answer this question, a conditional if statement is needed.
The pseudocode (and the program) starts by prompting user for input;
Then, the user input is first compared with 100,000
If it's less than 100,000; then nothing is displayes
However, if it is at least 100,000
"You earned a $5,000 bonus" is displayed
It further checks if the user input is greater than 125% of 90,000
If yes, "All Employees get the day off" is displayed else, nothing is displayed.
The pseudocode (and the program) stops execution, afterwards
C)private double monthlyFee
Explanation:
We want to change the BankAccount class so that all accounts will have a monthly fee. When a BankAccount is created, its monthly fee is set and cannot be changed. Which of the following will properly define the instance variable monthly Fee that holds the monthly fee is private double monthly fee
see attached
Step-by-step explanation:
A spreadsheet is a useful tool for keeping track of the numbers. A picture of one is attached.
We have assumed that the dollar amount for housing computed in the first part remains the same (though the percentage changes). If that is not the case, you'll have to recompute.
Likewise, we assume that the "5%" retirement amount remains 5% of the nominal salary, rather than 5% of the salary after the mandatory retirement deduction. Similarly, we assume dance lessons remain at their original amount, and were not reduced when the company began taking mandatory retirement.
Feel free to build your own spreadsheet and recompute as needed for any assumptions I got wrong, or for any additional scenarios.
see attached
Step-by-step explanation:
A spreadsheet is a useful tool for keeping track of the numbers. A picture of one is attached.
We have assumed that the dollar amount for housing computed in the first part remains the same (though the percentage changes). If that is not the case, you'll have to recompute.
Likewise, we assume that the "5%" retirement amount remains 5% of the nominal salary, rather than 5% of the salary after the mandatory retirement deduction. Similarly, we assume dance lessons remain at their original amount, and were not reduced when the company began taking mandatory retirement.
Feel free to build your own spreadsheet and recompute as needed for any assumptions I got wrong, or for any additional scenarios.
C)private double monthlyFee
Explanation:
We want to change the BankAccount class so that all accounts will have a monthly fee. When a BankAccount is created, its monthly fee is set and cannot be changed. Which of the following will properly define the instance variable monthly Fee that holds the monthly fee is private double monthly fee
It will provide an instant answer!