473,326 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Using Lists In C++

10
I am currently writing a C++ program that has to calculate and display the monthly mortgage payment amount using the amout of the mortgage, the term, and interest rate as input by the user. Next, I have to list the loan balance and interest paid for each payment over the term of the loan. On terms that are longer, the list may scroll off, I have to set the program that will not allow users to scroll off but instead display a partial list and allow the user to continue the list. I have to allow the user to loop back and enter new data or just quit. I have part of my code set up, I am just stuck on lists, so any direction will be greatly appreciated.
//************************************************** *****
//Program: Calculations Payments
//Purpose: To calculate a mortgage monthly payment by the user entering input
// and to to list the loan balance as well as the interest paid for each payment over the term of the loan.
// In addition, this program will allow the user to enter new data if they wish or to just quit the program.
//Programmer: Cameron Faldeti
//Date: 11/06/06
//School: University of Phoenix
//Class: POS 440: Introduction To C++
//Instructor: John Williams
#include <iostream>
#include <iomanip>
#include <cmath> //Header file in order for a user to calculate math formulas
#include <list> //C++ header file used for creating and storing items in lists
using namespace std;
int main()
{

//Variable declarations
double LoanAmount; //Loan amount entered by the user in order to calculate a mortgage monthly payment
int term; //Years entered by user to use for calculating the monthly payment
double InterestRate; //Interest Rate in percentage used for the loan amount
double MortgageMonthlyPayment;
char quit;//Allows users to quit the program if they wish
quit = 'N'; //If users enter N, they will have the option to enter new data
quit = 'n'; //If users enter n, they will have the option to enter new data
//Allow user to loop back and enter new data or to just quit the program
do
{
cout << "Enter a loan amount: ";
cin >> LoanAmount;
cout << "Loan amount is: $ " << LoanAmount << endl;
cout << "Enter Interest rate: ";
cin >> InterestRate;
cout << "Interest rate is: " << right << setw(8) <<InterestRate << "%" << endl << endl;
cout << "Enter term: ";
cin >> term; //Total years for paying off a mortgage loan
cout << "Your term is: " << right << setw(2) << term << " years" << endl << endl;
//Mortgage monthly calculation
MortgageMonthlyPayment = (LoanAmount* pow((1+ InterestRate/100/12),term*12)* InterestRate/100/12)/((pow((1+InterestRate/100/12),term*12))-1);
cout << "Mortgage monthly payment is: $ " << MortgageMonthlyPayment << endl;
list<balance> LoanBalance; //list loan balance
list<balance> InterestPaid; //list of interest paid over loan term

cout << "Press N if you want to enter new data, or press 1 or press 2 to quit the program." << "Choice is: " << endl; //Gives users a chance to continue or quit
cin >> quit;
}while(quit!= '1'&& quit != '2');
system("PAUSE");
return 0; //End of program
}
Nov 7 '06 #1
0 1702

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Thorsten Kampe | last post by:
I found out that I am rarely using tuples and almost always lists because of the more flexible usability of lists (methods, etc.) To my knowledge, the only fundamental difference between tuples...
9
by: Dave H | last post by:
Hello, I have a query regarding definition lists. Is it good practice semantically to use the dt and dd elements to mark up questions and answers in a frequently asked questions list, or FAQ? ...
1
by: Booser | last post by:
// Merge sort using circular linked list // By Jason Hall <booser108@yahoo.com> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> //#define debug
3
by: s_subbarayan | last post by:
Dear all, 1)In one of our implementation for an application we are supposed to collate two linked lists.The actual problem is like this: There are two singularly linked lists, the final output...
0
by: Phil Endecott | last post by:
Dear PostgreSQL people, I thought that some of you might be interested to know about Decimail, a new IMAP mail server that I've written that uses PostgreSQL to implement its message store. ...
2
by: Martin v. Löwis | last post by:
I've been working on PEP 353 for some time now. Please comment, in particular if you are using 64-bit systems. Regards, Martin PEP: 353 Title: Using ssize_t as the index type Version:...
10
by: AZRebelCowgirl73 | last post by:
This is what I have so far: My program! import java.util.*; import java.lang.*; import java.io.*; import ch06.lists.*; public class UIandDB {
4
by: Man4ish | last post by:
namespace ve/////////////////ve.h { struct VertexProperties { std::size_t index; boost::default_color_type color; }; }...
2
by: Man4ish | last post by:
I have created Graph object without vertex and edge property.It is working fine. #include <boost/config.hpp> #include <iostream> #include <vector> #include <string> #include...
36
by: pereges | last post by:
Hi, I am wondering which of the two data structures (link list or array) would be better in my situation. I have to create a list of rays for my ray tracing program. the data structure of ray...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.