1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
elena55 [62]
3 years ago
14

Create a program that calculates the monthly payments on a loan using Decimal & LC Console SEE Sanple Run Attached Specifica

tions  The interest rate should only use 1 decimal place for both the calculation and the formatted results.  The formula for calculating the monthly payment is: monthly_payment = loan_amount * monthly_interest_rate / (1 - 1 / pow( (1 + monthly_interest_rate), months))  Assume that the user will enter valid data.

Engineering
1 answer:
diamong [38]3 years ago
5 0

Answer:

Consider the following code.

Explanation:

Code:

Unix Terminal> cat loan_calc.py

#!/usr/local/bin/python3

import locale

from decimal import *

def main():

locale.setlocale(locale.LC_ALL, 'en_US')

print('Monthly Payment Calculator')

while True:

print('DATA ENTRY')

loan_amt = input('Loan amount: ')

loan_amt = float(loan_amt)

int_rate = input('Yearly interest rate: ')

int_rate = float(int_rate)

years = input('Years: ')

years = int(years)

mon_rate = int_rate / 12 / 100

months = years * 12

monthly_pay = loan_amt * mon_rate / ( 1 - 1/(1 + mon_rate) ** months)

monthly_pay = Decimal(monthly_pay).quantize(Decimal('.01'), rounding=ROUND_DOWN)

print()

print('FORMATTED RESULT')

print('Loan amount: %30s' %locale.currency(loan_amt))

print('Yearly interest rate: %20.2f' %int_rate + '%')

print('Number of years: %25d' %years)

print('Montly payment: %25s' %locale.currency(monthly_pay))

print()

print('Continue? (y/n): ')

choice = input().strip()

if choice.lower() == 'n':

break

if __name__=='__main__':

main()

Unix Terminal>

Code output screenshot:

You might be interested in
4. Set the height of the cutting tool tip
pav-90 [236]

Answer:

D

Explanation:

5 0
3 years ago
Pendulum impacting an inclined surface of a block attached to a spring-Dependent multi-part problem assign all parts NOTE: This
Art [367]

Answer:

vA = -2.55 m/s

vB = 0.947 m/s

Explanation:

Given:-

- The initial angle of rope, α = 30°

- The angle of rope just before impact or wedge angle, θ = 20°

- The weight of sphere, Ws = 1-lb

- The initial position velocity, vi = 4 ft/s

- The coefficient of restitution, e = 0.7

- The weight of the wedge, Ww = 2-lb

- The spring constant, k = 1.8 lb/in

- The length of rope, L = 2.6 ft

Find:-

 Determine the velocities of A and B immediately after the impact.

Solution:-

- We can first consider the ball ( acting as a pendulum ) to be isolated for study.

- There are no unbalanced fictitious forces acting on the sphere ball. Hence, we can reasonably assume that the energy is conserved.

- According to the principle of conservation for the initial point and the point just before impact.

Let,

              vA : The speed of sphere ball before impact

               

                  Change in kinetic energy = Change in potential energy

                  ΔK.E = ΔE.P

                  0.5*ms* ( uA^2 - vi^2 ) = ms*g*L*( cos ( θ ) - cos ( α ) )

                  uA^2 = 2*g*L*( cos ( θ ) - cos ( α ) ) + vi^2

                  uA = √ [ 2*32*2.6*( cos ( 20 ) - cos ( 30 ) ) + 4^2 ] = √28.25822

                  uA = 5.316 ft/s

- The coefficient of restitution (e) can be thought of as a measure of the extent to which mechanical energy is conserved when an object bounces off a surface:

                 e^2 = ( K.E_after impact / K.E_before impact )

- The respective Kinetic energies are:

               

                K.E_after impact = K.E_sphere + K.E_block

                                             = 0.5*ms*vA^2 + 0.5*mb*vB^2

                K.E_before impact = K.E = Ws*L*( cos ( θ ) - cos ( α ) )

                                                         = 1*2.6*( cos ( 20 ) - cos ( 30 ) )

                                                         = 0.1915 J

                32*2*0.1915*0.7^2 = Ws*vA^2 + Wb*vB^2  

                6.00544 = vA^2 + 2*vB^2  ... Eq1

- From conservation of linear momentum we have:

                vB = e*( uA - uB )*cos ( 20 ) + vA

                vB = 0.7*( 5.316 - 0 )*cos ( 20)   + vA

                vB = 3.49678 + vA  .... Eq 2

- Solve two equation simultaneously:

               

               6.00544 = vA^2 + 2*(3.49678 + vA)^2

               6.00544 = 3vA^2 + 13.98*vA + 24.455

               3vA^2 + 14.8848*vA + 18.4495 = 0

               vA = -2.55 m/s

               vB = 0.947 m/s

                                 

5 0
4 years ago
20. It is important to keep a copy of your written plan and safety records off-site.
Verdich [7]

Answer:

A

Explanation:

Incase you need to re-read or you need to refresh your memory.

Also, Incase something happens, you will have the rules and guidelines.

4 0
3 years ago
Thoughts on Anime?<br> Whats your fav
nlexa [21]
Is miraculous ladybug one
5 0
3 years ago
Read 2 more answers
Why were disc brakes invented?
kolezko [41]

Answer:

The answer is disc brake first evolved as a motorcycle braking system pattern just to become a smaller and remarkably lighter version of them.

Explanation:

  • <u><em>It consisted of a metal disc called rotor and callipers that were attached to the fork or frame and equipped with pads to squeeze the rotor for braking.</em></u>
6 0
2 years ago
Other questions:
  • An incoming signal is at a frequency of 500kHz. This signal needs to be acquired and all other signals attenuated. Design a pass
    5·1 answer
  • An AM broadcast station is transmitting at its assigned frequency of 880 Khz. The carrier is modulated by a 3.5 Khz sine wave. D
    15·1 answer
  • Two 2.30 cm × 2.30 cm plates that form a parallel-plate capacitor are charged to ± 0.708 nC . Part A What is the electric field
    7·1 answer
  • What instrument is used to measure temperature?
    10·1 answer
  • Whats the best used for Arch bridge
    11·1 answer
  • True or false a critique of hazwoper incidents that have occurred in the past year should not be included in hazwoper 8 hour ref
    6·1 answer
  • Give me some examples of fragile structures.
    5·1 answer
  • Can you think of a product that you love even though it may not work perfectly? Why do you love it?
    10·1 answer
  • What’s the answer to this I don’t understand
    14·1 answer
  • with a digital system, if you have measured incorrectly and use too low of a kvp for adequate penetration, what do you need to d
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!