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
ivolga24 [154]
4 years ago
8

(Financial application: compare loans with various interest rates) Write a program that lets the user enter the loan amount and

loan period in number of years and displays the monthly and total payments for each interest rate starting from 5% to 8% with an increment of 1/8
Computers and Technology
1 answer:
Tomtit [17]4 years ago
6 0

Answer:

// Program is written in C++ programming language

// Comments are used for explanatory purpose

// Program starts here

#include <iostream>

#include <cmath>

using namespace std;

int main ()

{

// Variable Declarations

int years; double amount;

// Get input for loan amount and period (in years)

cout<<"Loan Amount: ";

cin>>amount;

cout<<"Number of Years: ";

cin>>years;

// Display table header

cout<<"Interest Rate Monthly Payment Total Payment";

// Calculate and display interest rates

// Start iteration

for (double i = 5.0; i <= 8; i += 0.125) {

cout<<i;

// Calculate Monthly Interest Rate

double monthlyRate = i / 1200;

// Calculate and Print Monthly Payment

double monthlyPay = amount * monthlyRate / (1 - 1 / pow(1 + monthlyRate, years * 12)); cout<<monthlyPay; cout<<"\n"<<(monthlyPay * 12) * years);

}

return 0;

}

// End of program

You might be interested in
Implement a class Balloon that models a spherical balloon that is being filled with air. The constructor constructs an empty bal
amm1812

Answer:

Here is the Balloon class:

public class Balloon {  //class name

private double volume;  //private member variable of type double of class Balloon to store the volume

 

public Balloon()  {  //constructor of Balloon

 volume = 0;  }  //constructs an empty balloon by setting value of volume to 0 initially

 

void addAir(double amount)  {  //method addAir that takes double type variable amount as parameter and adds given amount of air

 volume = volume + amount;  }  //adds amount to volume

 

double getVolume()  {  //accessor method to get volume

 return volume;  }  //returns the current volume

 

double getSurfaceArea()  {  //accessor method to get current surface area

 return volume * 3 / this.getRadius();  }  //computes and returns the surface area

 

double getRadius()  {  //accessor method to get the current radius

 return Math.pow(volume / ((4 * Math.PI) / 3), 1.0/3);   }  } //formula to compute the radius

Explanation:

Here is the BalloonTester class

public class BalloonTester {  //class name

  public static void main(String[] args)    { //start of main method

      Balloon balloon = new Balloon();  //creates an object of Balloon class

      balloon.addAir(100);  //calls addAir method using object balloon and passes value of 100 to it

      System.out.println("Volume "+balloon.getVolume());  //displays the value of volume by getting value of volume by calling getVolume method using the balloon object

      System.out.println("Surface area "+balloon.getSurfaceArea());  //displays the surface area by calling getSurfaceArea method using the balloon object

             System.out.println("Radius "+balloon.getRadius());   //displays the value of radius by calling getRadius method using the balloon object

     balloon.addAir(100);  //adds another 100 cm3 of air using addAir method

       System.out.println("Volume "+balloon.getVolume());  //displays the value of volume by getting value of volume by calling getVolume method using the balloon object

      System.out.println("Surface area "+balloon.getSurfaceArea());  //displays the surface area by calling getSurfaceArea method using the balloon object

             System.out.println("Radius "+balloon.getRadius());    }  }  //displays the value of radius by calling getRadius method using the balloon object

//The screenshot of the output is attached.

6 0
3 years ago
Brittany is looking to advance in her current career. She is creating a plan to help strengthen and increase her skills. What qu
algol13
What areas do I need to improve
3 0
3 years ago
How is a for loop different from a repeat loop?
konstantin123 [22]

Explanation:

maybe because the for loop never have repeated like the repeat loop..

6 0
3 years ago
Undefined function 'symsum' for input arguments of type 'double'.
nata0808 [166]
The correct form is whom is thsi
5 0
3 years ago
What are MIDI signals?
Valentin [98]
Well it could possibly be two things.

Either it's like a standard protocol for communication between electronic musical instruments and computers.

Or


It's a Musical Interface Digital something or other.
4 0
3 years ago
Other questions:
  • An interface that doesn’t contain any constants or methods is called a ____________ interface.
    13·1 answer
  • Code a Boolean expression that tests if a decimal variable named currentSales is greater than or equal to 1000 or a Boolean vari
    11·1 answer
  • What are three ways you cite evedince
    5·2 answers
  • Hamish has created a website with an online booking system for his salon appointments. He wants to engage more with his customer
    11·1 answer
  • #include
    9·1 answer
  • 100BaseT network uses the TCP/IP protocol suite exclusively, and workstations on your network obtain addresses dynamically from
    6·1 answer
  • For the MIPS assembly instructions below, what is thecorresponding C statement? Assume that the variables f, g, h, i, and j are
    9·1 answer
  • How do a router and switch differ when handling a message? Both a router and a switch use the message’s destination address to s
    10·1 answer
  • To use a jQuery UI widget, you must code two things in the way that’s prescribed for the widget. What are they?
    5·1 answer
  • 20 points!!
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!