-
Notifications
You must be signed in to change notification settings - Fork 1
/
User.java
77 lines (68 loc) · 1.55 KB
/
User.java
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
package Daily1;
import java.util.ArrayList;
import java.util.Scanner;
public class User{
Scanner ip=new Scanner(System.in);
static Scanner ssc=new Scanner(System.in);
private static String name;
private static String password;
private String description;
private ArrayList<Expense> expense_list;
private ArrayList<Income> income_list;
public User(String name, String password){
this.name = name;
this.password = password;
this.expense_list = new ArrayList();
this.income_list = new ArrayList();
}
public User() {
// TODO Auto-generated constructor stub
}
public static String getName(){
name=ssc.next();
return name;
}
private static String getPassword(){
password=ssc.next();
return password;
}
public ArrayList<Expense> getExpenses(){
System.out.println("Enter description...");
description=ip.next();
Expense expense=new Expense(description+"");
expense_list.add(expense);
return this.expense_list;
}
public ArrayList<Income> getIncomes(){
System.out.println("Enter description...");
description=ip.next();
Income income=new Income(description+"");
income_list.add(income);
return this.income_list;
}
public static void main(String[] args)
{
User u=new User();
Scanner sc=new Scanner(System.in);
int opt=4;
while(opt!=3)
{
System.out.println("1.INCOME \n2.EXPENSE \n3.EXIT");
while(opt>3)
{
System.out.println("Enter a number between 1 and 3");
opt=sc.nextInt();
}
switch(opt)
{
case 1:
u.getIncomes();
break;
case 2:
u.getExpenses();
break;
default:
}
}
}
}