Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Prog1Tools.IOTools;
- public class Uhrzeitrechner {
- public static void main(String[] args) {
- System.out.println();
- System.out.println("Uhrzeitrechner");
- System.out.println();
- System.out.println("1: Zeitspanne berechnen");
- System.out.println("2: Uhrzeit erhöhen");
- System.out.println();
- System.out.println();
- int Eingabe = readline();
- String uhrzeit;
- String uhrzeit2;
- switch (Eingabe) {
- case 1: System.out.println("Zeitpunkt 1 eingeben");
- uhrzeit = IOTools.readLine();
- String[] zp1 = uhrzeit.split(":");
- System.out.println();
- System.out.println("Zeitpunkt 2 eingeben");
- uhrzeit2 = IOTools.readLine();
- String[] zp2 = uhrzeit2.split(":");
- System.out.println();
- zp1[0] = Integer.parseInt(zp1[0]);
- zp1[1] = Integer.parseInt(zp1[1]);
- zp2[0] = Integer.parseInt(zp2[0]);
- zp2[1] = Integer.parseInt(zp2[1]);
- if (zp1[0] < 0 || zp1[0] > 24 || zp1[1] < 0 || zp1[1] > 59 || zp2[0] < 0 || zp2[0] > 24 || zp2[1] < 0 || zp2[1] > 59) {
- System.out.println("Falsche Eingabe");
- };
- int teil1 = zp1[0] - zp2[0];
- int teil2 = zp1[1] - zp2[1];
- int t1 = 0;
- int t2 = 0;
- if (teil1 < 0) {teil1 = teil1 * (-1);};
- if (teil2 < 0) {teil2 = teil2 * (-1);};
- if (teil1 < 10) {t1 = 1;};
- if (teil2 < 10) {t2 = 1;};
- if (t1 == 0 && t2 == 0) {System.out.println("Zeitspanne beträgt: " + teil1 + "h " + teil2 + "min"); break;};
- }}}
- ------------------------------------------------------------------------------------------------------------------------------------------
- C:\Users\sasch\Desktop\Java Programme\Uhrzeitrechner.java:30: error: incompatible types: int cannot be converted to String
- zp1[0] = Integer.parseInt(zp1[0]);
- ^
- C:\Users\sasch\Desktop\Java Programme\Uhrzeitrechner.java:31: error: incompatible types: int cannot be converted to String
- zp1[1] = Integer.parseInt(zp1[1]);
- ^
- C:\Users\sasch\Desktop\Java Programme\Uhrzeitrechner.java:32: error: incompatible types: int cannot be converted to String
- zp2[0] = Integer.parseInt(zp2[0]);
- ^
- C:\Users\sasch\Desktop\Java Programme\Uhrzeitrechner.java:33: error: incompatible types: int cannot be converted to String
- zp2[1] = Integer.parseInt(zp2[1]);
- ^
- C:\Users\sasch\Desktop\Java Programme\Uhrzeitrechner.java:35: error: bad operand types for binary operator '<'
- if (zp1[0] < 0 || zp1[0] > 24 || zp1[1] < 0 || zp1[1] > 59 || zp2[0] < 0 || zp2[0] > 24 || zp2[1] < 0 || zp2[1] > 59) {
- ^
- first type: String
- second type: int
- C:\Users\sasch\Desktop\Java Programme\Uhrzeitrechner.java:35: error: bad operand types for binary operator '>'
- if (zp1[0] < 0 || zp1[0] > 24 || zp1[1] < 0 || zp1[1] > 59 || zp2[0] < 0 || zp2[0] > 24 || zp2[1] < 0 || zp2[1] > 59) {
- ^
- first type: String
- second type: int
- C:\Users\sasch\Desktop\Java Programme\Uhrzeitrechner.java:35: error: bad operand types for binary operator '<'
- if (zp1[0] < 0 || zp1[0] > 24 || zp1[1] < 0 || zp1[1] > 59 || zp2[0] < 0 || zp2[0] > 24 || zp2[1] < 0 || zp2[1] > 59) {
- ^
- first type: String
- second type: int
- C:\Users\sasch\Desktop\Java Programme\Uhrzeitrechner.java:35: error: bad operand types for binary operator '>'
- if (zp1[0] < 0 || zp1[0] > 24 || zp1[1] < 0 || zp1[1] > 59 || zp2[0] < 0 || zp2[0] > 24 || zp2[1] < 0 || zp2[1] > 59) {
- ^
- first type: String
- second type: int
- C:\Users\sasch\Desktop\Java Programme\Uhrzeitrechner.java:35: error: bad operand types for binary operator '<'
- if (zp1[0] < 0 || zp1[0] > 24 || zp1[1] < 0 || zp1[1] > 59 || zp2[0] < 0 || zp2[0] > 24 || zp2[1] < 0 || zp2[1] > 59) {
- ^
- first type: String
- second type: int
- C:\Users\sasch\Desktop\Java Programme\Uhrzeitrechner.java:35: error: bad operand types for binary operator '>'
- if (zp1[0] < 0 || zp1[0] > 24 || zp1[1] < 0 || zp1[1] > 59 || zp2[0] < 0 || zp2[0] > 24 || zp2[1] < 0 || zp2[1] > 59) {
- ^
- first type: String
- second type: int
- C:\Users\sasch\Desktop\Java Programme\Uhrzeitrechner.java:35: error: bad operand types for binary operator '<'
- if (zp1[0] < 0 || zp1[0] > 24 || zp1[1] < 0 || zp1[1] > 59 || zp2[0] < 0 || zp2[0] > 24 || zp2[1] < 0 || zp2[1] > 59) {
- ^
- first type: String
- second type: int
- C:\Users\sasch\Desktop\Java Programme\Uhrzeitrechner.java:35: error: bad operand types for binary operator '>'
- if (zp1[0] < 0 || zp1[0] > 24 || zp1[1] < 0 || zp1[1] > 59 || zp2[0] < 0 || zp2[0] > 24 || zp2[1] < 0 || zp2[1] > 59) {
- ^
- first type: String
- second type: int
- C:\Users\sasch\Desktop\Java Programme\Uhrzeitrechner.java:42: error: bad operand types for binary operator '-'
- int teil1 = zp1[0] - zp2[0];
- ^
- first type: String
- second type: String
- C:\Users\sasch\Desktop\Java Programme\Uhrzeitrechner.java:43: error: bad operand types for binary operator '-'
- int teil2 = zp1[1] - zp2[1];
- ^
- first type: String
- second type: String
- 18 errors
Add Comment
Please, Sign In to add comment