HELP A FAILING KID! Banking - Investing / Borrowing

I have been working on this for a month and it was due last week, so I really need help. My friend has given up on me so I don't know what to do... I'm so lost so if anyone could help me! that would be great...

I need someone to look it over.. I have no clue how to post the coding up on this thing .. so please help!!!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#include<iostream>
#include<string>											// library to hold information
#include<ctime>												// library to handle math

using namespace std;

	// Prototype
		float investment();									// if the user picks to invest
		float borrow();										// if the user picks to borrow
		int loop();											// Function to loop the entire banking

int main()
{
	string userName;										// user's name
	string answer;											// user's decision to invest or borrow
	char i;													// user wants to invest
	char b;													// user wants to borrow
	float money;											// how much money the user is wanting to borrow or invest into the bank
	int interest;											// Annual interest rate
	int Return;												// money being returned
	float amount;											// how much money being returned
	float goal;												// investment goal 
	char loop;												// the user decides to loop
	int y;													// user picks to loop
	int n;													// user closes the bank
	char repeat;											// indicates to repeat
	repeat = y;												// Looping wil occuring when user picks 'y'

	cout << "~***~~***~~***~[: Welcome to the Kwantlen Bank :]~***~~***~~***~ " << endl;

	cout << "What would you like to put your bank account under: ";
	cin >> userName;

	cout << "Hello " << userName << ", Do you wan to invest (i) with us or borrow (b) from us? ";
	cin >> answer;

	loop = int loop()

	system("pause");
	return 0;
}

	// Definition 
	
	int loop()
		// Purpose: loop banking if the user wants to
		// Parameters: Borrowing + investment
		// Returns: Main	
	{
			char loop;											// the user decides to loop
			string y;												// user picks to loop
			string n;												// user closes the bank
			char i;													// user wants to invest
			char repeat;											// indicates to repeat
			string answer;										// user's answer
			repeat = y;										// Looping wil occuring when user picks 'y'
			answer == int y || int n;							// answer equals yes or no
		{
			if(answer == 'i')										// user decides to invest
			{
			i = float investment()								// Function: when user wants to invest
			}

			else if (answer == b)
			{
			b = float borrow()									// Function: when user wants to borrow
			}
		} while (repeat == y)									// closes the do... while

			cout >> "Do another investment/loan calculation (y/n)? ";
			cin << repeat;
	}

		float investment()
		// Purpose: To do all investments without crowding the main
		// Parameters: Only investment
		// Returns: Main
		{
			char i;													// user wants to invest
			float money;											// how much money the user is wanting to borrow or invest into the bank
			int interest;											// Annual interest rate
			float goal;												// investment goal

			cout << "Enter the amount to invest annually: ";
			cin >> money;

			cout << endl;

			cout << "Enter the yearly percentage rate of return: "";
			cin >> interest;

			cout << endl;

			cout << "Enter the investment goal: ";
			cin >> goal; 

			cout << endl;

			cout << "	Year			Balance			Balance		" << endl;
			cout << "				    (Jan. 1)	   (Dec. 31)	" << endl;
			cout << "					"; 

		}

		float borrow()
		// Purpose: To do all borrowing without crowding the main
		// Parameters: Only investment
		// Returns: Main
		{
			char b;													// user wants to borrow
			float money;											// how much money the user is wanting to borrow or invest into the bank
			int Return;												// money being returned
			float amount;											// how much money being returned

			cout << "Enter the amount to loan: ";
			cin >> money;

			cout << endl;

			cout << "Enter the annual payment amount: ";
			cin >> Return;

			cout << endl;

			cout << "Enter the investment goal: ";
			cin >> amount; 

			cout << endl;

			cout << "	Year			Balance			Balance		" << endl;
			cout << "				    (Jan. 1)	   (Dec. 31)	" << endl;
			cout << "					" ;
		} 
Last edited on
Copy and paste the code, then highlight it and click the symbols that look like this: <> on the right.

Then post it.

yup
But you need to make sure your computer is on.
By the way did you know all your source code files can be opened with Notepad?
oh thanks! ..

i updated it now..

I really have no clue how to fix it to work.
Can you post the nature of this assignment? I'm having a hard time deciphering what the code is supposed to do.
I'll write out the question...

"You are to write a program that will do two things for the user: it will help them to evaluate how long it will take to achieve a certain investment goal given an annual investment amount and an annual rate of return; also, it will help them to evaluate how long it will take to pay off a loan given a principal amount, an annual payment amount and an annual interest rate. When the user runs the program, the program should ask which one of these procedures the user wants to perform, and then do that procedure. If the user wants to do another set of calculations (for example: for a loan instead of an investment, or for a loan followed by another loan), they will have the option of doing another set of calculations."
For repeating a calculation multiple times you could try something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
do
{
   // ....perform some sort of calculation....
   // ....
   // ....


   char repeat;
   cout << "would you like to repeat? (y/n)";
   cin >> repeat;
   while((repeat != 'y') && (repeat != 'Y') && (repeat != 'n') && (repeat != 'N'))
   {
        cout << "Invalid input. would you like to repeat? (y/n)";
        cin >> repeat;
   }
}while((ans == 'y') || (ans == 'Y'))
;

The do-while loop will execute the body at least once and then it may execute it several more times depending on if the argument inside "while" is true. I think you should think about starting the code over again and this time test the code whenever you get a little bit done. So first I would write a code making sure the program allows you to perform the calculation multiple times, then I would add the code that lets you calculate the investment and make sure THAT works and finally I would include the code that does the calculation for the loan. This may sound time consuming but I think it'll save you more time in the end.
I handed in as what I have it, I didn't understand anything~
Thanks for trying to help though!
you should learn the basics of c++ first, i see you have syntax errors...

like this:
 
loop = int loop()


you should write it like this:

1
2
3
4
5
6
7
8
9
10
11
12
//declare it first
//and don't forget the semicolon
int loop();

//as far as i know, you can't use the same name with function
int loop_one;

//don't forget to define you loop() function
loop_one = loop();

//you can declare it like this too:
//int loop_one = loop(); 
Topic archived. No new replies allowed.