Koordinaten Eingabe

Zahl eingeben um Start/endpunkt auszuwählen
This commit is contained in:
corinna.sailer 2020-06-29 15:38:08 +02:00
parent b3311af325
commit e93ec34e1d
2 changed files with 69 additions and 6 deletions

View File

@ -40,9 +40,9 @@ public class _0_Constants {
public static double VELOCITY = 10; // Die Geschwindigkeit sollte Pi betragen
// Winkel vom Startpunkt & Endpunkt
public static double PHI_S = 139.72;
public static double THETA_S = 35.68;
public static double PHI_E = 52.52;
public static double THETA_E = 13.37;
public static double PHI_S;
public static double THETA_S;
public static double PHI_E;
public static double THETA_E;
}

View File

@ -1,5 +1,5 @@
package app;
import java.util.Scanner;
import java.util.Timer;
//import javax.swing.JButton;
@ -14,7 +14,8 @@ public class _1_GeoAnimation_CreateAnimation {
private static JFrame frame;
public static void main(String[] args) {
startmenu();
endmenu();
//open new thread for time measurement
ApplicationTime animThread = new ApplicationTime();
animThread.start();
@ -25,6 +26,68 @@ public class _1_GeoAnimation_CreateAnimation {
timer.scheduleAtFixedRate(new FrameUpdate(frame), 100, _0_Constants.TPF);
}
public static void startmenu() {
int select;
Scanner scan = new Scanner(System.in);
System.out.println("Start:");
System.out.println("1: Berlin");
System.out.println("2: Tokyo");
System.out.println("3: New York");
System.out.println("4: Kapstadt");
select = scan.nextInt();
switch(select) {
case 1:
_0_Constants.PHI_S = 52.52; //breite
_0_Constants.THETA_S = 13.37; //Länge
break;
case 2:
_0_Constants.PHI_S = 139.72;
_0_Constants.THETA_S = 35.68;
break;
case 3:
_0_Constants.PHI_S = -74.0;
_0_Constants.THETA_S = 40.71;
System.out.println("NY");
break;
case 4:
_0_Constants.PHI_S = 18.42;
_0_Constants.THETA_S = -33.9;
break;
}
}
public static void endmenu() {
int select;
Scanner scanner = new Scanner(System.in);
System.out.println("Das Ziel:");
System.out.println("1: Berlin");
System.out.println("2: Tokyo");
System.out.println("3: New York");
System.out.println("4: Kapstadt");
select = scanner.nextInt();
switch(select) {
case 1:
_0_Constants.PHI_E = 52.52; //breite
_0_Constants.THETA_E = 13.37; //Länge
break;
case 2:
_0_Constants.PHI_E = 139.72;
_0_Constants.THETA_E = 35.68;
break;
case 3:
_0_Constants.PHI_E = -74;
_0_Constants.THETA_E = 40.71;
break;
case 4:
_0_Constants.PHI_E = 18.42;
_0_Constants.THETA_E = -33.9;
break;
}
if(_0_Constants.PHI_E == _0_Constants.PHI_S && _0_Constants.THETA_E == _0_Constants.THETA_S) {
System.out.println("Wieso solltest du zum selben Ort gehen wollen, an dem du eh schon bist???");
endmenu();
}
}
//create a JFrame as my container for the simulation content
private static void CreateFrame(ApplicationTime thread) {