Question

In: Computer Science

Choose one of the three following programs to do as your first program. You need to...

Choose one of the three following programs to do as your first program. You need to turn in a flowchart and program documentation with the .cpp program (this can be done within the program) and a copy of your output.

The Program I chose is :

#19. Monthly Payments

The monthly payment on a loan may be calculated by the following formula:

Payment= Rate × (1+Rate)N (1+Rate)N−1×L

Rate is the monthly interest rate, which is the annual interest rate divided by 12. (12 percent annual interest would be 1 percent monthly interest.) N is the number of payments, and L is the amount of the loan. Write a program that asks for these values then displays a report similar to:

Loan Amount:$10000.00

Monthly Interest Rate: 1%

Number of Payments: 36

Monthly Payment:$ 332.14

Amount Paid Back:$ 11957.15

Interest Paid:$ 1957.15

Solutions

Expert Solution

CODE FOR THE FOLLOWING PROGRAM:-

#include <iostream>
#include <cmath>    //for pow()
#include <iomanip>  //for setw() and setprecision()

using namespace std;

int main()
{
    //Declaration of variables
    float lAmount,rate,mPayment,totalAmount,totalInterest;
    int noOfPayments;
    
    //Asking user to input values
    cout<<"Enter the loan amount: \n";
    cin>>lAmount;
    cout<<"Enter the monthly Interest Rate: (input should be in %)\n";
    cin>>rate;
    rate=rate/100;
    cout<<"Enter number of payments: \n";
    cin>>noOfPayments;
    
    //calculating monthly payment
    mPayment=((rate*(pow(rate+1, noOfPayments)))/((pow(rate+1, noOfPayments))-1))*lAmount;
    
    //calculating total amount to be paid
    totalAmount=mPayment*noOfPayments;
    
    //calculate amount of interest paid
    totalInterest=totalAmount-lAmount;
    
    //Printing the Report
    //Setw and setprecision are used for formatting
    cout << "Loan amount:            $" << setprecision(2) << fixed << setw(5) << lAmount << endl;
    cout << "Monthly Interest Rate:  " << setprecision(0)<<rate*100 << "%" << endl;
    cout << "Number of Payments:     " << noOfPayments << endl;
    cout << "Monthly Payment:        $" << setprecision(2) << fixed << setw(5) << mPayment << endl;
    cout << "Amount Paid Back:       $" << setprecision(2) << fixed << setw(5) << totalAmount << endl;
    cout << "Interest Paid:          $" << setprecision(2) << fixed << setw(5) << totalInterest << endl;
    return 0;
}

DOCUMENTATION FOR PROGRAM:-

 // FILE:         payment.cpp
   // TITLE:        Your title goes here
   // SUBMITTED BY:  Your Name goes here
   //                
   // FOR COURSE:  Course Name goes here  
   // DUE DATE:     ... 
   //
   // PURPOSE:
   // This program will calclulate the monthly payment on a loan
   //calcluated along with total amount paid and intrest paid
  
 
   // OVERALL METHOD:
   //The list of general task is:
   //Ask user to enter Loan Amount, Monthly Interest Rate and Number of Payments
    //calclulate Monthly Payment,Amount Paid Back and Interest Paid
    //Print Loan Amount, Monthly Interest Rate and Number of Payments
    //print Monthly Payment,Amount Paid Back and Interest Paid

   
    // INCLUDED FILES:
   //    iostream.h
   //    iomanip.h
   //    cmath.h
   
   // DATA FILES:
   //    none

FLOW CHART:-

SCREENSHOT OF THE PROGRAM AND SAMPLE OUTPUT:-

SAMPLE OUTPUT:-

HAPPY LEARNING


Related Solutions

Write program logic or pseudocode to create 3 small programs that do the following: The first...
Write program logic or pseudocode to create 3 small programs that do the following: The first should compute the sum of 2 given integers. The second should multiply the 2 integers. The third should triple the sum of the 2 integers.
Write a java program that will first display the following menu: Choose one of the following...
Write a java program that will first display the following menu: Choose one of the following 1- To add 2 double integers 2- To add 2 integer numbers 3- To add 3 double numbers 4- To add 3 integer numbers After reading user’s choice, use a switch case statement to call the corresponding method Void add 1 (double n1, double n2) Void add2() Double add3 (double n1, double n2, double n3) Double add4 ()
I need you to do both of the programs. Please specify which program is which! Array...
I need you to do both of the programs. Please specify which program is which! Array Allocator: Write a function that dynamically allocates an array of integers. The function should accept an integer argument indicating the number of elements to allocate. The function should return a pointer to the array. Call the function in a complete program. Reverse Array: Write a function that accepts an int array and the array’s size as arguments. The function should create a copy of...
Hello, What other info do you need.   For your final project, choose three areas of healthcare...
Hello, What other info do you need.   For your final project, choose three areas of healthcare ethics that interest you. These could be topical areas or current events. In a single document, summarize each of the three areas in two paragraphs per case, and why you would like to explore them. Ask one ethical and one legal question that might be present within the realm of each topic. 1, Confidentiality - The protection of private patient information in the medical...
To complete this assignment, choose one of the THREE topics of your choice (see below), do...
To complete this assignment, choose one of the THREE topics of your choice (see below), do a thorough research and analysis on the topic, write it up, and finally submit it as an attached document. 6. Here are the THREE topics and all you need is to pick the one that is of interest to you : (i) China and the US have been in serious disputes and disagreements in areas of international trade and commerce. Present a background on...
To complete this assignment, choose one of the THREE topics of your choice (see below), do...
To complete this assignment, choose one of the THREE topics of your choice (see below), do a thorough research and analysis on the topic, write it up, and finally submit it as an attached document. 6. Here are the THREE topics and all you need is to pick the one that is of interest to you: (i) China and the US have been in serious disputes and disagreements in areas of international trade and commerce. Present a background on the...
The government in your country is considering three programs that affect the market for cigarettes. Program...
The government in your country is considering three programs that affect the market for cigarettes. Program 1: Media campaigns and labelling requirements aimed at making the public aware of the dangers of smoking. Program 2: A price-support for tobacco farmers Program 3: a cap on the number of cases of cigarettes sold per quarter at 20,000 cases Determine the impact on the market for cigarettes if Program 1, 2, 3 is implemented. Impact on demand Impact on supply Impact on...
The government in your country is considering three programs that affect the market for cigarettes. Program...
The government in your country is considering three programs that affect the market for cigarettes. Program 1: Media campaigns and labeling requirements aimed at making the public aware of the dangers of cigarette smoking. Program 2: A price-support program for tobacco farmers. Program 3: A cap on the number of cases of cigarettes sold per quarter at 20,000 cases. Determine the impact of the market for cigarettes if Program 1 is implemented. Chose from answers below: Decrease towards equilibrium   a)...
Write a C++ program to choose one of the following five options for your summer vacation...
Write a C++ program to choose one of the following five options for your summer vacation Hawaii Bahamas Cancun Las Vegas Europe Your program should select one of the above option. Once the option is selected then your program should select one of the following airlines: US Air Delta Southwest Continental American Airline Once the airline is selected then read number of passengers airfare for round trip. Calculate the total charge. make your own charges
3. Write a C++ program to choose one of the following five options for your summer...
3. Write a C++ program to choose one of the following five options for your summer vacation 1. Hawaii 2. Bahamas 3. Cancun 4. Las Vegas 5. Europe Your program should select one of the above option. Once the option is selected then your program should select one of the following airlines: 1. US Air 2. Delta 3. Southwest 4. Continental 5. American Airline Once the airline is selected then read number of passengers airfare for round trip. Calculate the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT