C/C++ :: Calculating Interest Earned On Bank-account
Oct 21, 2014
This exercise should familiarise you with loops, if-then-else statements, and recursion. You will have to design and implement a program that calculates the interest earned on a bank-account. Deadline is the end of Tuesday in week 4.
Interests are compounded; that is, you earn interest on interest. Given a yearly interest rate of say, 6%, you can calculate the total sum available when an initial sum of 4000 pounds is put away for 13 years as follows:
4000 * ( (1 + [6/100])^13 ) = 8531.71 pounds
where the caret symbol denotes 'to the power of'. One way to calculate the power is by repeatedly mulitplying. Ie, you can mulitply 1.06 with 1.06 12 times to calculate 1.06^13.
PART 1
Design and implement a function that raises X to the power Y for a real number X and a positive integer Y. The function must use a while loop.
Design and implement a main program that calculates the sum availble when 1000 pounds has been put away for 25 years with 5 percent interest.
Change the while-loop in the function to a for-loop.
View 12 Replies
ADVERTISEMENT
Feb 13, 2013
i am currently doing a mini bank account system using visual studio...i need using the header files...the question requires to use 3 header files for each class.these are the classes:
a)Accounts
b)CurrentAccounts
c)SavingAccounts
i have done the first part... how to do a new class in a different header file..
View 3 Replies
View Related
Apr 20, 2014
I have an odd compiling error. My base class is all delcared and read to go. But I could not figure out how to get my sub classes inherit from it. So I had to make everything public. Even inheriting using the protected inheritance thingy, still could not get them to inherit from that base class.
So I compiled the program, and no other class came back with an error. only my base class. Here is the base class:
#include <iostream>
#include <string>
using namespace std;
class Bankaccount {
[Code] .....
The error I'm getting is saying:
error C2143: syntax error : missing ';' before 'using'
Where is there anything needing a semicolon before using?
'Bankaccount' : 'class' type redefinition
see declaration of 'Bankaccount'
Is it saying this because I don't have any private class members?
'Bankaccount' : base class undefined
But it is defined.
What is the issue with this class? And how can I get it to compile and run?
View 10 Replies
View Related
Mar 5, 2014
Following function is from a bank account, when new account is created it won't store it in the array or i guess it does but find_acct function wont be able to find it.
find_acct Function:
int findacct(int acctnum_array[], int num_accts, int requested_account) {
for (int index = 0; index < num_accts; index++)
if (acctnum_array[index] == requested_account)
return index;
return -1;
[Code] ....
View 2 Replies
View Related
Mar 1, 2015
I am trying to figure out the best way to approach a part of a project I am working on for school. I need to put in a 6 digit account number that will not allow duplicates for another user. How to approach this .
View 1 Replies
View Related
Feb 4, 2013
For each quarter, calculate and display the beginning principal balance, the interest earned, and the final principal balance for the quarter.For example: The user entered 1000.00 for the beginning principal balance, 5.25 for the interest rate, and 8 for the number of quarters. The output from this part of the program should be similar to the following:
Q| Beginning Principle| Interest Earned| End Principle
1| $1,000.00 | $13.13 | $1,013.13
2| $1,013.13 | $13.30 | $1,026.42
3| $1,026.42 | $13.47 | $1,039.89
etc
Here is the code I have so far, and I just am not quite sure where to go next.
Code:
{
cout << "Quarters" << " " << "Beginning Principles" << " " <<"Interest Earned" << " " <<"End Principal" << endl;
endprin = balance + (quarter * interest);
interest = quarter * interest;
cout << endprin << endl;
}
View 2 Replies
View Related
Jun 21, 2013
Equation for compound interest. The interest is supposed to be $43.34 according to the book, I am ending up with around $35. The actual equation is amount = principal * (1 + rate/t)^t where t = number of times compounded per year. I still have to go through and clean up all the code I just want the formula working first.
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main () {
float princ, rate, comp, savings, interest, rates, year;
[Code] .....
View 2 Replies
View Related
Jun 7, 2013
I am making this program for a class and it works fine except for the daily interest rate for the checking account is off. The daily interest for the savings computes perfectly. The monthly interest rate for savings is 6% and for checking 3%.
Account.h
#ifndef ACCOUNT_H
#define ACCOUNT_H
#include <iostream>
#include <string>
using namespace std;
const int DAYS_PER_MONTH = 30;
[Code] ....
View 1 Replies
View Related
Sep 24, 2014
Im having problems coding this
A = P(1 + r/n)nt
//Declared test cases
float principal = 200000.00, annualInt = 0.03;
float years = 10.0;
float calcInterest1(float principal, float years, float annualInt) {
float interest1;
float nt = annualInt*12;
float A = principal+annualInt;//Accrued Amount
interest1 = (A = (principal*(1+years/100))pow(nt));// A = P(1 + r/n)nt
return interest1;
}
View 1 Replies
View Related
Jan 17, 2013
I was trying to make a program of calculating simple intrest using functions. I don't know whats wrong with the program but it always shows a wrong output.
#include<iostream.h>
#include<conio.h>
float si(int p,int r,int t) {
return ((p*t*r)/100.0);
[Code] ....
View 4 Replies
View Related
Feb 11, 2014
math part.
The equation I need to use is: payment = [(rate * (1 + rate)^number payments ) / ((1 + rate)^number of payments -1)] * loan
Also, the value of rate in the above equation is (interest/12)/100. So 12% annual interest would be 1% monthly interest.
heres my code:
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
[Code].....
View 4 Replies
View Related
Sep 27, 2013
Here is my code:
int main (int argc, char* argv[]) {
int x = atoi (argv[1]);
int y = atoi (argv[2]);
int z = atoi (argv[3]);
if (strcmp(argv[4], "Simple") == 0){
[Code ....
I need to convert the output of simple interest to float which is $5184.90 instead of $5180. how to go about it?
View 3 Replies
View Related
Mar 1, 2014
I have an assignment to write a program using structures, getting input from a .txt file and output in text file as well. I have written a program that only reads and prints the data. I am trying to test if it works fine or not. I always comment an unnecessary code but still it wont compile. Now whats wrong with this program?
/* Bank Accounts Program */
#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>//needed to use system() function
using namespace std;
const int MAX_NUM = 50;
void menu();
[Code]...
View 1 Replies
View Related
Feb 25, 2014
I am creating a bank account using classes. I have created the classes and now implementing them in my main program. I haven't written anything in the withdraw, find acct and all functions except "read account: read_acct()" because i wanna test if it reading the data from my .txt file or not. Dont know whats wrong with the program its not executing. Would let know that i'm new to classes and objects. Following is the code:
****************************************************
*************MAIN PROGRAM*************************
****************************************************
****Bank Accounts.cpp****
[Code]....
View 5 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
Feb 17, 2014
Anyhow, I have a program due Wednesday that is along the lines of the classic Bank Teller simulation using Queue's.
Unlike most of these programs, I have to integrate my own Queue, QueueNode, Teller, and Customer classes. I have attached all of these headers below plus the main file.
Now the error: While I'm sure there are other issues with the code, it will not let me create a new customerQueue (of Queue type) object as such:
Queue<Customer> customerQueue;
The error it is giving me is:
no matching constructor for initialization of 'Queue<Customer>'
Here is my code:
Queue.h:
#ifndef QUEUE2_H_
#define QUEUE2_H_
#include <iostream>
#include "Teller.h"
#include "Queue.h"
[Code] ....
View 1 Replies
View Related
Oct 31, 2013
I am trying to pull my words randonly from a wordbank .txt file and so far i have this
#include <iostream>
#include <cctype>
#include <fstream>
using namespace std;
string word;
char knownLetters[]; // The word could be of any length
int stages = 6; // Our hangman has 6 stages, so the player starts with 6 lives
[Code] .....
View 1 Replies
View Related
Oct 4, 2014
In this assignment, you are going to write a program that keeps track of the social security numbers (SSN) of customers of a bank. Please notice that we are going to assume that SSN is a four-digit number (e.g., 1234. 0123 is not allowed.). When the program runs, it prompts that the user should enter a 4-digit SSN number to record, or 0 (zero) to exit.
So far I have this:
#include <iostream>
using namespace std;
bool isExist(int ssn, int records[], int numberOfRecords);
int main(){
int ssn = 0;
int records[32];
[Code] .....
View 16 Replies
View Related
Jun 26, 2013
I am trying to write a program that keeps track of social security numbers (SSN) of customers of a bank. I have to assume that SSN is a four-digit number (e.g., 1234. 0123 is not allowed.). When the program runs,it has to prompt that the user should enter a 4-digit SSN number to record, or 0 (zero) to exit.
The program also needs to be able to give an error message if a certain number is entered more than once.
After all the numbers have been saved and you finally end it by pressing 0, it needs to be able to output all the entered SSN's.
Here is my code so far :
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
bool isExist(int ssn, int records[], int numberOfRecords);
void listRecords(int records[], int numberOfRecords);
int main()
[Code]...
View 2 Replies
View Related
Apr 11, 2013
It is suppose to display the message "This Account ID does not exist" but why do I get "segmentation fault"??I was able to compile and run the program so it shouldn't be a problem of the compiler.
Code:
#include <stdio.h>#include <string.h>
struct Account {
char* Account_ID;
char* Account_Type;
char* AccountOwner_FirstName;
char* AccountOwner_LastName;
float* Balance;
[Code]....
View 11 Replies
View Related
Dec 16, 2013
I'm trying to do is write a program that fits to a separate test program. The test program provides different size vectors that my function should try and binary search. If the element is found, the function should return 1, and if the element is not found, it returns -1.
Here is the code:
int binSearch(const vector<double> & data, int elem, int & comps) { {
int beg=data[0];
int end=data[data.size()-1];
int mid=(end+beg)/2;
[Code] ......
The problem is that one of the vectors my function is supposed to binary search is a vector of size 0. I tried to throw in an if statement that would return -1 if the size was == 0, but then the program never fully completed and just kept running. So, how can I account for a size 0 vector in my function?
View 2 Replies
View Related
Apr 21, 2013
as i am doing an encryption program on a playfair cipher. I am now stuck on a problem on decryption.If my string is helloworld (without a space), it will decrypt normally.However , if my string has a space in between it. Let`s say Hello World, it will not decrypt normally.How do i take into account the space that is in between hello & world?
example: hello world
View 4 Replies
View Related
Mar 18, 2014
I want to create user account and login to windows. I have to read username from DB and create window user for login to window. So,Can I create windows account and login to windows with C#
View 8 Replies
View Related
Dec 9, 2013
I am trying to make a for loop that will print out chars in an array while using a #define before main. My problem is that each name has a different amount of chars in it. How do you account for that when you are trying to define a size? For example, I am playing around with the numbers and I just put 7 in for size:
Code:
#include <stdio.h>
#define sizeOf 7
//char personName( char * name[] );
char printName ( char * name[]);
[Code] .....
View 8 Replies
View Related
Jul 27, 2013
So I'm trying to fill a vector with pointers to account objects.
std::vector<account*> fill_vector() {
std::vector<account*> temp;
std::ifstream s;
std::string str;
s.open("H://account2.dat");
[Code] ....
The accounts have four different types and I am supposed to skip over ones that have an invalid account type and throw an exception:
account* factory(std::string account_code, std::string first_name,
std::string last_name, char type, double balance) {
try {
if(type == 'A') {
simple_account *a = new simple_account(account_code, first_name, last_name, balance);
[Code] .....
My problem is they program will not skip over my rejected accounts.. still adds them to the vector but I cant figure out why!
View 8 Replies
View Related