-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRentRecord.java
55 lines (41 loc) · 1.33 KB
/
RentRecord.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
import java.io.*;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.Scanner;
public class RentRecord
{
static ArrayList<RentRow> rentList = new ArrayList<RentRow>(50);
private int apNumber;
public void insertRent(RentRow Rent)
{
rentList.add(Rent);
}
public void display() throws FileNotFoundException
{
PrintStream o = new PrintStream(new File("RentRecord.txt"));
PrintStream console = System.out;
System.setOut(o);
System.out.println("AptNo Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
System.out.println("------------------------------------------------------");
for(int i = 0; i < rentList.size(); i++)
{
System.out.println(rentList.get(i).getAptNum()+" " + rentList.get(i).toString());
}
System.setOut(console);
System.out.println("AptNo Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
System.out.println("------------------------------------------------------");
for(int i = 0; i < rentList.size(); i++)
{
System.out.println(rentList.get(i).getAptNum()+" " + rentList.get(i).toString());
}
}
public static float rentSum()
{
float sum = 0;
for(int i = 0; i < rentList.size(); i++)
sum += rentList.get(i).getRent();
return sum;
}
}