Courses implementation
This commit is contained in:
parent
0d77f9cb8b
commit
f97260e256
@ -19,7 +19,7 @@ public class Location {
|
||||
public Location(double lat, double lon) {
|
||||
latitude = lat;
|
||||
longitude = lon;
|
||||
city = cityBasedOnIP();
|
||||
//city = cityBasedOnIP(); //API intansive
|
||||
}
|
||||
|
||||
public Location() {
|
||||
@ -51,7 +51,7 @@ public class Location {
|
||||
this.longitude = lon;
|
||||
}
|
||||
|
||||
private String cityBasedOnIP() {
|
||||
public String cityBasedOnIP() {
|
||||
String city = "";
|
||||
try {
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
//TODO: save Person as JSON
|
||||
@ -6,7 +9,6 @@ public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Person p = new Person(12345, "Hesham", Level.BA);
|
||||
System.out.println(p.getLocation().getCity());
|
||||
System.out.println("-------------------------------------------------");
|
||||
Scanner in = new Scanner(System.in);
|
||||
System.out.print("Name: ");
|
||||
@ -19,6 +21,8 @@ public class Main {
|
||||
p.getEdu().setSchool(in.next());
|
||||
System.out.print("Major: ");
|
||||
p.getEdu().setMajor(in.next());
|
||||
List<Course> list = Arrays.asList(Course.EE201, Course.EE250,Course.ISLS201);
|
||||
p.getEdu().addCourses(list);
|
||||
Print(p);
|
||||
}
|
||||
|
||||
@ -48,12 +52,18 @@ public class Main {
|
||||
*/
|
||||
public static void Print(Person p) {
|
||||
System.out.println(
|
||||
"\t---------INFO---------\n"
|
||||
"\n\n\n\t---------INFO---------\n"
|
||||
+ "\tName: "+p.getAccount().getName()+"\n"
|
||||
+ "\tID: "+p.getAccount().getID()+"\n"
|
||||
+ "\tMajor: "+p.getEdu().getMajor()+"\n"
|
||||
+ "\tSchool: "+p.getEdu().getSchool()+"\n"
|
||||
+ "\tAccountType: "+p.getAccount().getAccountType());
|
||||
+ "\tCity: "+p.getLocation().cityBasedOnIP()+"\n"
|
||||
+ "\tAccountType: "+p.getAccount().getAccountType()+"\n"
|
||||
+ "\t---------COURSES---------");
|
||||
int i = 1;
|
||||
for (Course course : p.getEdu().getCourses()) {
|
||||
System.out.println("\tCourse "+i+": "+course.name());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user