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
GarryVolchara [31]
3 years ago
6

It is desired to create a mortgage estimator by writing a program containing a function. The user inputs the amount of loan (L),

the loan term in number of months (W, and the annual interest rate (D in the script. The script then makes use of a function that accepts these values as inputs through its argument and calculates and returns the monthly payment and the total payments over the life of the loan. The monthly payment and the total payment could be calculated using the following expressions:
monthly payment 1-(1+ 1 112) N I/12 total payment Nxmonthly payment
Note that the interest rate must be expressed in decimal; for example, if the interest rate is 8% it must be entered as 0.08 Test your program for several scenarios and submit the results with the program listing.
The values of L, I, monthly payment, and total payment should be written to a file as shown below:
Interest Loan Amount Interest Months Monthly Payment Total Payment
0.06 10000 36
108 120000 0.05
0.07 85000 48
0.08 257000 240
0.05 320000 120
Computers and Technology
1 answer:
lianna [129]3 years ago
4 0

Answer:

In Python:

L = int(input("Loan Amount: "))

N = int(input("Months: "))

I = float(input("Annual Interest Rate: "))

monthly_payment = round(L/((1 - (1 + I/12)**(-N))/(I/12)),2)

total_payment = round(N * monthly_payment,2)

 

f= open("outputfile.txt","a+")

f.write(str(L)+"\t\t"+str(I)+"\t\t"+str(N)+"\t\t"+str(monthly_payment)+"\t\t"+str(total_payment)+"\n")

Explanation:

The next three lines get the required inputs

<em>L = int(input("Loan Amount: ")) </em>

<em>N = int(input("Months: ")) </em>

<em>I = float(input("Annual Interest Rate: "))</em>

Calculate the monthly payment

monthly_payment = round(L/((1 - (1 + I/12)**(-N))/(I/12)),2)

Calculate the total payment

total_payment = round(N * monthly_payment,2)

Open the output file

f= open("outputfile.txt","a+")

Write output to file

f.write(str(L)+"\t\t"+str(I)+"\t\t"+str(N)+"\t\t"+str(monthly_payment)+"\t\t"+str(total_payment)+"\n")

You might be interested in
Describe how pseudocode makes programming more efficient for large programming tasks.
Talja [164]

Answer:Pseudocode helps us understand tasks in a language-agnostic manner. Is it best practice or suggested approach to have pseudocode creation as part of the development lifecycle? For instance:

Identify and split the coding tasks

Write pseudocode

Get it approved [by PL or TL]

Start Coding based on Pseudocode

Explanation: use phrasing tool if you want to write in your own words.

6 0
3 years ago
Read 2 more answers
What order? (function templates) Define a generic function called CheckOrder() that checks if four items are in ascending, neith
vlabodo [156]

Answer:

Explanation:

The following code was written in Java and creates the generic class to allow you to compare any type of data structure. Three different test cases were used using both integers and strings. The first is an ascending list of integers, the second is a descending list of integers, and the third is an unordered list of strings. The output can be seen in the attached image below.

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Order: " + checkOrder(10, 22, 51, 53));

       System.out.println("Order: " + checkOrder(55, 44, 33, 22));

       System.out.println("Order: " + checkOrder("John", " Gabriel", "Daniela", "Zendaya"));

   }

   public static <E extends Comparable<E>> int checkOrder(E var1, E var2, E var3, E var4) {

       E prevVar = var1;

       if (var2.compareTo(prevVar) > 0) {

           prevVar = var2;

       } else {

           if (var3.compareTo(prevVar) < 0) {

               prevVar = var3;

           } else {

               return 0;

           }

           if (var4.compareTo(prevVar) < 0) {

               return 1;

           }  else {

               return 0;

           }

       }

       if (var3.compareTo(prevVar) > 0) {

           prevVar = var3;

       }

       if (var4.compareTo(prevVar) > 0) {

           return -1;

       }

       return 0;

   }

}

8 0
3 years ago
Write an overloaded constructor for the Table class that will take a single argument for the color of the table Write a set meth
creativ13 [48]

Explanation:

Below is required code in java :-

public class Table{

   private String color;    //attribute to store the color of the table

   public Table(){    //default constructor

       this.color="";   //set a default blank color

   }

   public Table(String color){    //overloaded constructor

       this.color=color;    //set the color value equal to the parameter provided

   }

   public void setColor(String color){    //setter or mutator method

       this.color=color;    //set the color value equal to the parameter provided

   }

}

8 0
3 years ago
The following is the pseudocode for which type of algorithm? For start = each array subscript, from the first to the next-to-las
Snezhnost [94]

Answer:

Sorting Algorithm

Explanation:

Here we are arraigning the elements in ascending order. Using for loop we are iterating through all the elements. in one iteration the first minimum element in the list is at 1st place and in the second iteration the second minimum element is in 2nd position and so on

8 0
3 years ago
Select the correct term to complete the sentence.
Anna11 [10]

Answer:

its user interface

Explanation:

4 0
2 years ago
Other questions:
  • Write a program that defines a type for a structure that stores information on a student in ENG EK 125. Declare two variables to
    8·1 answer
  • Which event occurs when the user clicks on an html element?
    9·1 answer
  • (15 POINTS) Integrated Circuits Of Made Up Of _____ That Carry The Electrical Current.
    10·1 answer
  • What is the term meaning a Java object that has attributes and methods?
    12·1 answer
  • Write the correct word to complete the sentence:
    7·1 answer
  • A _______ is a website specially designed to allow visitors to use their browser to add, edit, or delete the site's content.
    9·2 answers
  • Describe how being a global citizen in the world of advanced technology can be beneficial to your success in meeting your person
    13·1 answer
  • Which of the following bit value represent -5 in two's complement notation?
    5·1 answer
  • MODS ONLY answer this, I have something for you. I'm reporting this to make it easier
    14·1 answer
  • Deirdre has a hearing disability. One of her friends advised her to use real-time text or RTT on her phone. In which of these
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!