forked from epeguero8311/Team-Green
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStoreRecords.java
More file actions
38 lines (33 loc) · 1.03 KB
/
StoreRecords.java
File metadata and controls
38 lines (33 loc) · 1.03 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
import java.util.*;
public class StoreRecords {
public ArrayList<InsuranceRecord> records;
public StoreRecords() {
records = new ArrayList<InsuranceRecord>();
}
public void add_record(InsuranceRecord record) {
records.add(record);
}
public ArrayList<InsuranceRecord> get_first_n_records(int N){
ArrayList<InsuranceRecord> first_n_records = new ArrayList<InsuranceRecord>();
for (int i = 0; i < N && i < records.size(); i++) {
first_n_records.add(records.get(i));
}
return first_n_records;
}
}
class InsuranceRecord {
public int age;
public double bmi;
public int children;
public double charges;
public String region;
public boolean smoker;
public InsuranceRecord(int age, double bmi, int children, double charges, String region, boolean smoker) {
this.age = age;
this.bmi = bmi;
this.children = children;
this.charges = charges;
this.region = region;
this.smoker = smoker;
}
}