-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRentInputScreen.java
127 lines (105 loc) · 2.68 KB
/
RentInputScreen.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
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
import java.util.Scanner;
import java.io.*;
public class RentInputScreen {
TenantList list = new TenantList();
RentRecord rRecord = new RentRecord();
private String renter;
private float rentPaid;
private int month;
private int aptNum;
private float jan = 0;
private float feb = 0;
private float mar = 0;
private float apr = 0;
private float may = 0;
private float june = 0;
private float july = 0;
private float aug = 0;
private float sept = 0;
private float oct = 0;
private float nov = 0;
private float dec = 0;
private float sum = 0;
private String choice;
public void inputScreen()
{
Scanner scan = new Scanner(System.in);
jan=0;feb=0;mar=0;apr=0;may=0;june=0;july=0;aug=0;sept=0;oct=0;nov=0;dec = 0;
boolean moreRent = true;
System.out.println("Enter tenant's name (George Smith)");
renter = scan.nextLine();
aptNum = TenantInputScreen.list.getAptNumber(renter);
while(moreRent == true)
{
System.out.println("Enter amount paid (345.67):");
rentPaid = scan.nextFloat();
System.out.println("Enter month rent (1-12)");
month = scan.nextInt();
if(month == 1)
{
jan = rentPaid;
}
else if (month == 2)
{
feb = rentPaid;
}
else if(month == 3)
{
mar = rentPaid;
}
else if(month == 4)
{
apr = rentPaid;
}
else if(month == 5)
{
may = rentPaid;
}
else if(month == 6)
{
june = rentPaid;
}
else if(month == 7)
{
july = rentPaid;
}
else if(month == 8)
{
aug = rentPaid;
}
else if(month == 9)
{
sept = rentPaid;
}
else if(month == 10)
{
oct = rentPaid;
}
else if(month == 11)
{
nov = rentPaid;
}
else if(month == 12)
{
dec = rentPaid;
}
System.out.println("Would you like it input more rent payments for this user? (Yes/No)");
choice = scan.next();
if(choice.equals("Yes") || choice.equals("yes"))
{
moreRent = true;
}
else if(choice.equals("No")|| choice.equals("no"))
{
moreRent = false;
break;
}
}
RentRow rent = new RentRow(aptNum, jan,feb,mar,apr,may,june,july,aug,sept,oct,nov,dec);
rRecord.insertRent(rent);
}
public void displayRentRecord() throws FileNotFoundException
{
rRecord.display();
}
}