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
To test the effects of a new fertilizer, 100 plots were divided in half. Fertilizer A is randomly applied to one half, and B to
Kruka [31]

Answer:

(b) a matched pairs experiment.

Explanation:

Matched pairs experiment are a special case of a random block design and is usually used when the experiment only has two conditions. In this case the conditions are the different fertilizers.

7 0
3 years ago
Read 2 more answers
A mass of 1.9 kg of air at 120 kPa and 24°C is contained in a gas-tight, frictionless piston–cylinder device. The air is now com
emmainna [20.7K]

Answer:

W=-260.66 kJ (negative answer means, that the work was done on the gas)

Explanation:

1) Convert temperature from C to K- T=24+273=297K- all temperature in the gas problems should be used in Kelvins;

2) We need to analyse type of the process- it is given, that the temperature is constant, so it is an Isothermal process, which means, that the equation of the process is: pV=const (constant);

3) Work, done on the system, should be calculated using the following equation: W=\int\limits^{Vb}_{Va} {p} \, dV

4) To calculate initical and final volumes (Va and Vb), we can use the following equation: pV=mRT, so V=mRT/p. Note, that the pressure is changing, thus we can calculate volumes for the both cases- initial and final, using initial (120kPa) and final (600kPa) pressures, in addition, we can find equation for the pressure, as function of the volume, which we need to use for the integration in step 3: p=mRT/V;

5) Now we can calculate the integral, given in the step 3: W=mRT ln(\frac{Vb}{Va}). As we have pressure as a known values, we can re-write the equation, using pressures: W=mRT ln(\frac{pa}{pb})=1.9*0.287*279*ln(\frac{120}{160})=-260.66 kJ

Note, that natural logarithm (ln) yields negative answer, which supports the question, that the work was done on the gas, not by the gas.

6 0
3 years ago
If 20 kg of iron, initially at 12 °C, is added to 30 kg of water, initially at 90 °C, what would be the final temperature of the
rjkz [21]

Answer:

final temperature of the combined system T = 84.78°C

Explanation:

Given data

mass of iron ( m1 )   = 20 kg

temperature iron ( t1 ) =  12 °C

mass of water ( m2 ) = 30 kg

temperature of water ( t2 )   =  90 °C

To find out

final temperature of the combined system

solution

we know the energy requirement formula to rise the temp

energy = mass × specific heat  × change in temperature  

we combine both system so both energy will be added

and

we know specific heat of iron ( c1 ) = 0.450 kJ/kg

and specific heat of water ( c2 ) = 4.186 kJ/kg

4.186 joule/gram °C

now combine both energy

energy = mass, m1 × specific heat, c1  × change in temperature, T - t1 + mass, 2 × specific heat, c2  × change in temperature, T - t2

energy = 20 × 0.450  × T - 12  + 30 × 4.186 × T -90

(20)(0.45)(T−12)=(30)(4.186)(90−T)

final temperature of the combined system T = 84.78°C

5 0
3 years ago
2. A Class B fire includes burning:
vovangra [49]

Answer: The answer is C. Gasoline and greases and here is some more info

In fire classes, a Class B fire is a fire in flammable liquids or flammable gases, petroleum greases, tars, oils, oil-based paints, solvents, lacquers, or alcohols. For example, propane, natural gas, gasoline and kerosene fires are types of Class B fires.

Explanation:

3 0
4 years ago
In electric heaters, electrical energy is converted to potential energy. a)-True b)-false?
son4ous [18]

Answer:

False

Explanation:

In electric heater electric energy is converted into heat energy. In heater wires are present which have resistance and current is flow in heater when we connect the heater to supply.

And we know that whenever current is flow in any resistance then heat is produced so in electric heaters electric energy is converted into heat energy

So this is a false statement

8 0
3 years ago
Other questions:
  • Indicate whether the following statements are true or false for a reversible process: (A) Q=0. (B) Work may be calculated using
    14·1 answer
  • Can you tell me important facts about Peggy A. Whitson?
    5·1 answer
  • How high does receptacles have to be in a house
    14·1 answer
  • On a ruler or tape measure, what is the distance from 1 3/8 to 3 1/2?​
    11·1 answer
  • The bulk modulus of a fluid if it undergoes a 1% change in volume when subjected to a pressure change of 10,000 psi is (a) 0.01
    13·1 answer
  • You are asked to design a software package for an On-line Banking System (OBS). The OBS will take requests from its user on the
    14·1 answer
  • When framing a wall, temporary bracing is
    15·1 answer
  • Sort the following alphabets using MergeSort and give required steps. [2 Marks]
    9·1 answer
  • What is land administration and cadastral survey
    8·1 answer
  • A 24-volt DC battery is connected
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!