forked from Luc8102/Finance
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfinance.java
More file actions
51 lines (49 loc) · 2.1 KB
/
Copy pathfinance.java
File metadata and controls
51 lines (49 loc) · 2.1 KB
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
import java.util.Scanner;
//test from Minh test
public class finance
{
public static void main(String[] args)
{
float total=0;
float weekly=0;
Scanner scan = new Scanner(System.in);
System.out.println("What is your expected annual expendenture at retirement?");
float retirementSpending = scan.nextFloat();
System.out.println("How much have you saved for retirement?");
float retirementSavings = scan.nextFloat();
System.out.println("For tax purposes, what is your yearly income?");
float income = scan.nextFloat();
System.out.println("What is your age?");
byte income = scan.nextByte();
//Everything before this line are preliminary questions to ask the user in order to calculate everything else.
//below is a loop that was initally supposed to take the spending of every day and make a weekly report, but this may be misplaced
for(short i=0;i<365;i++)
{
System.out.println("How much have you spent today?");
float today = scan.nextFloat();
total+=today;
weekly+=today;
if(i%7==0)
{
System.out.println("-------Weekly report\n You spent $" + weekly + " This week. Save "For retiurement " every week to retire at" _____)
weekly = 0;
}
}
}
//below is the calculation to find how much money the user will have at age 65
public float retirement(float retirementSpending, float income, float retirementSavings, byte age, float expenses)
{
this.retirementSpending;
this.income;
this.retirementSavings;
this.age;
this.expenses;
yearsLeft=65-age;
moneyAt65=retirementSavings+(yearsLeft*(income-expenses));
//returns amount of money at age 65. the next step is to use the question i asked before "What is your expected annual expendenture at retirement?"
//in order to calculate how many years this person has of spending
//one thing I did not include in the income is social security checks. I also didnt take into consideration the tex brackets.
//I think i have a good start. if you could please finish it, that would be great im getting tired.
return moneyAt65;
}
}