-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInvestment_calculator_using_methods.txt
48 lines (40 loc) · 1.35 KB
/
Investment_calculator_using_methods.txt
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
Question 3a - Create an investment prograam that calculate the amount in a method
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Investment_calculator_using_methods
{
internal class Program
{
static int INVESTED_MONEY = 5000;
static int INTEREST_PERCENTAGE = 2;
static int PERCENTAGE = 100;
static int YEARS_TOTAL = 1;
static int amount;
static void Main(string[] args)
{
//Declarations of variables
int totalAmount;
//Open the program
Console.WriteLine("Welcome to the Investment Program:");
//Call a method to calculate the investment total
totalAmount = CalculateInvestmentTotal();
//Display the amount of the investment
Console.WriteLine("\nThe investment for one year is:" + totalAmount);
}
static int CalculateInvestmentTotal()
{
//Declarations
int INVESTED = 5000;
int INTEREST = 2;
int PERCENTAGE = 100;
int YEARS = 1;
int amount;
//Calculate the amount
amount = INVESTED * YEARS * INTEREST/ PERCENTAGE;
return amount;
}
}
}