C :: Calculating Loan Balance - Finding The Condition For Loop
May 18, 2013
Write a program to calculate the Loan Balance, where a person borrows an amount A and in return he/she agrees to make N payments per year, each of amount P. While the person is repaying the loan, interest will accumulate at an annual percentage rate of R, and this interest will be compounded N times a year (along with each payment). Therefore, the person must continue paying these installments of amount P until the original amount and any accumulated interest is repaid.
NOTE: The formula to calculate the amount that the person needs to repay after T years is-
Balance Amount after T years = A[(1+R/N)^NT]-P
-----------------------------------------------------------
I have a few doubts :
1. I think that the "balance amount" formula can directly give the "loan balance" for the person. I'm not sure if it's correct but in that case the question would serve no purpose. Maybe I'm wrong.
2. If there should be a loop to calculate the loan balance, what condition should I give and which loop will be better to use?
View 11 Replies
ADVERTISEMENT
Sep 22, 2013
so i am just hitting writers block on this one... its lengthy and i am very little into it...
The program takes 4 entered values (total loan, apr, monthly payment, and length of loan).
It is to put out a table that gives the new loan balance each month and the total interest payed at the bottom.
View 2 Replies
View Related
Oct 6, 2014
I've written a bit of code :
#include <iostream>
#include <cmath>
#include <cstdio>
int main() {
for(int i=1; i<=1000; i++)
for(int j=i+1; j<=1000; j++)
for(int k=j+1; k<=1000; k++)
[Code] ...
Now why does defining the if condition as if(pow(i,2) + pow(j,2) == pow(k,2)) doesnt work (ie. doesn't print anything) while defining it as if(i*i + j*j == k*k) works flawlessly - by working I mean printing out single set of 3 numbers.
View 4 Replies
View Related
May 23, 2014
I found a for loop in an example that I don't understund fully.
Code:
for (i=64; i; i/=2)
printf("i: %d
",i);
Now this is dividing by 2 until it reach '1' and stops. But why does this stops?
View 6 Replies
View Related
Dec 8, 2014
The while loop part of my program isn't working right. stringOriginal is an array. If a large amount of characters passed the max 80 im processing is typed, it goes into a infinite loop. Also the condition doesn't work i type in quit and the loop continues.
while(stringOriginal != "quit"){
std::cout << "Enter a string of characters you would like to reverse
";
cin.getline(stringOriginal,79,'
');
}
View 1 Replies
View Related
Oct 26, 2013
I need to do make a loop inside a condition. Can it be done? I don't want to call another function to do it. Any way at all without calling separate function inside the if? I just want to do:
if (
for (int i = 0; i<=10; i++)
{
//stuff related to the for loop
} )
{
//stuff related to the initial if condition
};
View 7 Replies
View Related
Aug 11, 2014
I'm writing a delete function for a linked list, and I'm having issues with this bit of code:
void deleteNode(int data){
node* del = NULL;
t = h;
n = h;
while(n != NULL && n->_data != data){
t = n;
n = n->next;
}
}
Or more precisely, this portion:
&& n->_data != data
n is my new node variable, _data is the storage variable in the private section of my class, and data is the information being searched for that needs to be deleted. Everything works without this section of the code. My assumption is that n->_data is somehow wrong, but I don't see how. I've tried everything I can think of- using parenthesis, using the variable rather than the pointer, I've tried expressing the pointer in a different way, I've tried using my t variable rather than n, and I've found examples online that use this exact same expression without any issues.
View 2 Replies
View Related
Feb 10, 2014
I need to calculate the expected time it takes to do an activity using a formula provided and after the loop is broken it needs to show the number of projects processed and the project with the longest expected time. I've got everything working except for finding the the project with the longest expected time. What I have here just keeps displaying the number of the last project processed regardless of if it was the largest or not, specifically lines 54-61 is what i can't seem to figure out.
#include <stdio.h>
int main( void ) {
unsigned int counter;
int projectnumber;
int optimistictime;
int realistictime;
[Code] .....
View 1 Replies
View Related
Feb 9, 2013
I'm trying to write a program that will allow a user to enter infinite numbers (one at a time) with a way to stop entering values, and once it stops it immediately displays:
Lowest number:
Highest number:
Number of values entered:
Average of numbers:
what I can't figure out is:
-how to end the loop with something other than a number, preferably a char, so that it doesn't affect the average/lowest/highest
-how to output the lowest and highest numbers in a loop (would be easier to figure out were it finite and I could just type a bunch of printf/scanf)
What I have so far:
Code:
#include <stdio.h>#include <stdlib.h>
#define pause system("pause")
main(){
//n = amount of numbers input
//x = number given by user
//s = smallest number
//l = largest number
}
[code].....
View 4 Replies
View Related
Sep 29, 2014
I've been working at this for awhile and it seems like it should be correct but it isn't giving me the desired output. Here's my code.
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <iomanip>
[Code]....
And here is my output when I run the program.
75
Max: 90
Min: 0
Press any key to continue . . I am reading from a file in this program which contains a set of 30 numbers and it has the average correct and the max correct but the minimum number in the set is 56 however it keeps giving me a zero for the min.
View 4 Replies
View Related
Aug 26, 2014
Keep track of the sum of values entered (as well as the smallest and the largest) and the number of values entered. When the loop ends, print the smallest, the largest, the number of values,and the sum of values. Note that to keep the sum, you have to decide on a unit to use for that sum; use cm.
View 9 Replies
View Related
Jan 22, 2013
I want to finding maximum and minimum values of 10 numbers using for loop and the program work wrong !!
#include <iostream>
using namespace std;
int main() {
int x;
int max = -999999999;
int min= 999999999;
[Code] ....
View 2 Replies
View Related
Oct 29, 2014
We were discussing how to find average time complexity of different algorithms. Suppose I've a the following nested loop
for(int i=0;i<n;i++)
{
min = i;
[Code].....
Now the outer loop will iterate N times. the inner loop will always iterate 3 times no matter what the value of N is. so the worst case time complexity should be O(n^2) but what about the average case and the best case? I mean in terms of searching we can figure out and distinguish between the worst,best and average as it depends upon the number of comparisons. But here how can the average and best case be different then the worst case.
View 13 Replies
View Related
Sep 10, 2013
I am stuck looking at whats the problem ....
#include <iostream>
using namespace std;
int main() {
float average, largest = 0, smallest = 0;
int count = 1;
int num;
[Code] .....
View 1 Replies
View Related
Jun 6, 2014
I'm trying to build an interactive loan calculator for a school project. These are the requirements:
Your program should do the following:
•Display a Welcome title for the Loan Calculator
•Prompt the user to enter the price of the car
•Prompt the user to enter the length of the term in months
•Prompt the user to enter the APR in percentage (e.g. 4.79%) - without the percent sign of course
Your program should then report with the monthly payment will be.
Use setw() and setfill() to display the content like a receipt. All the data should be neatly displayed.
Example
For a Friend Loan Calculator
Price of Vehicle: $25,000
Term of Loan (in months): 60
APR in percentage (e.g. 4.79% - without the percent sign): 3.8
--------------------------------------------------------------
Total Monthly Payments: $433.50 //NOT ACCURATE
Display all money totals (output values) to two decimal places. You should output an accurate result as well.
For extra credit you may factor in a state auto sales tax of 6.5% of the purchase price of the vehicle and how much of a down payment the user would like to put down. Of course, if you are factor down payment, you must prompt the user to enter that amount.
I attempted to build one but I'm getting a lot of errors using Microsoft visual studio. Here it is below:
Interactive Loan Calculator
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
using namespace std;
int num1,
num2,
response,
[Code] .....
View 3 Replies
View Related
Apr 7, 2014
I have a problem requiring me to :
enter loan amount:
Enter interest rate:
Enter length of loan (years)
It wants me to input the minimum amount for the loan, and the minimum interest rate. and then output a table that has 5 loan amounts across the top in $10000 increments and 4 interest rates along the side in .25% increments.
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main () {
double loan, interest, length, payment,ti;
//Enter loan price
[Code] .....
View 1 Replies
View Related
Jan 25, 2013
Your objective is to write a program that calculates the simple interest for a given loan amount and duration (in years).
Formula:
Simple interest = loan amount X interest rate X number of years
Assume interest rate is a constant 6% per year.
Specifically, your program will:
1. Output descriptive header
2. Prompt and read any customer’s first name, middle initial, and last name individually
3. Prompt and read the principal/loan amount
4. Prompt and read the duration of the loan in years
5. Calculate the interest
6. Output:
a. Customer full name
b. Principal/loan amount
c. Duration of loan
d. Interest rate
e. Interest on loan
f. Principal and interest due at end of term
OK SO THIS IS MY PROGRAM SO FAR. As you can see i got it all but i am so confused with as to for loan amount and duration of year, if i should use float or double to declare it?
i need to finish this assignment by calculating the simple interest and i dont know how or where to begin.
int main(){
system("color f0");
string firstName;
string middleInitial;
string lastName;
cout<<"Please enter your First Name: ";
[Code]...
View 1 Replies
View Related
Nov 18, 2013
Write a program to create an output file containing a customized loan amortization table. Your program will prompt the user to enter the amount borrowed (the principal), the annual interest rate, and the number of payments (n). The payment must be rounded to the nearest cent. After the payment has been rounded to the nearest cent, the program will write to the output file n lines showing how the debt is paid off.
Code:
#include <stdio.h>
#include <math.h>
int main (void) {
[Code].....
View 1 Replies
View Related
Jul 14, 2012
I'm trying to create a program to balance a checkbook. In the program, I want to be able to list the deposits and withdrawals individually, as well as the total deposits, total withdrawals, beginning and ending balances. I am trying to set up two different arrays to do this, but how to set them up the right way.
Code:
//checkbook.cpp
//EmilyBattaglia
//final project part C
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
//declare variables
[code].....
View 1 Replies
View Related
Jul 2, 2014
So if I have an array how do I convert it to a balance binary tree?
View 1 Replies
View Related
Feb 1, 2014
I receive this error, been couple hours try to understand, but i havent find the solution.
i get the error here:
case 2:
currentBalance(balance);
main ();
is it because it doesnt have a value, i serious dont know what my problem.
My whole code.
// Lucky ATM.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
[code]....
View 13 Replies
View Related
Oct 25, 2014
I have part of it done but im not sure how to get my amount balance to get into my other functions from my file...
#include<iostream>
#include<fstream>
using namespace std;
void welcomeUser();
bool readFile();
void menu();
[Code] ....
and the amount saved that I have in the file is 1200
View 14 Replies
View Related
Apr 8, 2014
I don't really have an issue with the math behind this, rather it's more with the code structure itself. Basically, every row is right, except for the last row. The last row (year) needs to be depreciated by the value at the beginning of the last row (year).
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
[Code]......
View 2 Replies
View Related
Mar 24, 2014
I had a quick question about how to check the balance of brackets in an HTML file using a stack (pushing and popping). I understand pushing and popping. I get lost when it comes to the logic of having to actually check what is in the brackets, and making sure those are nested correctly.
So while
<title><b> THIS FILE </b> USES CORRECTLY NESTED TAGS </title>
is correct and
<title> <b> THIS FILE </title> IS </b> NOT NESTED CORRECTLY.
is incorrect;
How do I check for the actual tags inside the brackets, keeping in mind that there are single sided tags as well.
(ex. <img src="a.jpg"/>)
View 8 Replies
View Related
Dec 11, 2014
(I'm using visual c++). Write a program that calculates the balance of a savings account at the end of a three month
period. It should ask the user for the starting balance and the annual interest rate. A loop should then iterate once for every month in the period, performing the following:
A) Ask the user for the total amount deposited into the account during that month. Do not accept negative numbers. This amount should be added to the balance.
B) Ask the user for the total amount withdrawn from the account during that month. Do not accept negative numbers or numbers greater than the balance after the deposits for the month have been added in.
C) Calculate the interest for that month. The monthly interest rate is the annual interest rate divided by 12. Multiply the monthly interest rate by the average of that month’s starting and ending balance to get the interest amount for the
month. This amount should be added to the balance.
After the last iteration, the program should display a final report that includes the following information:
• starting balance at the beginning of the three-month period.
• total deposits made during the three months
• total withdrawals made during the three months
• total interest posted to the account during the three months
• final balance.
What I need is to solve that particular problem using a class. Here is the code solved for the problem not using a class:
#include<iostream>
using namespace std;
int main() {
double annulInterestRate,
balance,
monthlyInterestRate,
[Code] .....
View 8 Replies
View Related
Jun 13, 2014
I am running a little business on the side, any program I could use that will show me the balances of clients after withdrawals, deposits. For example, if i had a data file like this :
Code:
e 5 Elden
c 3 Felipe 55342.51415
e 3 Leonardo
e 1 Yong
[Code] ....
Lines beginning with 'e' will have an integer employee ID and an employee name.
Lines beginning with 'c' will have an integer customer ID, customer name, and a floating point account balance.
Lines beginning with a 't' will have a customer ID, employee ID, a 'w' or 'd' representing withdrawal or deposit,
and a floating point transaction amount.
Now, obviously the program doesn't have to be exactly like this but something along these lines.
View 4 Replies
View Related