-
Notifications
You must be signed in to change notification settings - Fork 10
/
List_test(v1).java
45 lines (36 loc) · 931 Bytes
/
List_test(v1).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
package selection;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class List_test {
/*set arr list*/
private ArrayList<Course> coursesToSelect;
private String inp;
private int num;
public List_test(){
this.coursesToSelect = new ArrayList<Course>();
this.inp = getChar();
this.num = getId();
}
public String getChar() {
Scanner sc = new Scanner(System.in);
System.out.print("Please enter the course:");
String s = sc.next();
return s;
}
public int getId() {
Scanner sc = new Scanner(System.in);
System.out.print("Please enter the id:");
int n = sc.nextInt();
//sc.close();
return n;
}
public void testAdd() {
/*add courses to List*/
Course c1 = new Course(this.num, this.inp);
coursesToSelect.add(c1);
Course temp = coursesToSelect.get(0);
System.out.printf("Course %d:%s has been updated", temp.getId()
, temp.getName());
}
}