Skip to content

Commit

Permalink
Read skip error FIXED
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusjordan committed Apr 26, 2019
1 parent 210cb41 commit fb20a93
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
Binary file removed bin/model/Input.class
Binary file not shown.
Binary file added bin/org/input4j/Input.class
Binary file not shown.
29 changes: 21 additions & 8 deletions src/model/Input.java → src/org/input4j/Input.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package model;
package org.input4j;

import java.util.Scanner;

Expand All @@ -7,36 +7,49 @@ public abstract class Input {

public static Integer Int(String menssage) {
System.out.printf(menssage);
return Integer.parseInt(read.next());
Integer i = Integer.parseInt(read.next());
return i;
}

public static Long Long(String menssage) {
System.out.printf(menssage);
return Long.parseLong(read.next());
Long l = Long.parseLong(read.next());
return l;
}

public static Character Char(String menssage) {
System.out.printf(menssage);
return read.next().charAt(0);
Character c = read.next().charAt(0);
return c;
}

public static String Str(String menssage) {
System.out.printf(menssage);
return read.nextLine();

//Corrige erro de pular leitura
if(read.hasNext()) {
read.nextLine();
}

String s = read.nextLine();
return s;
}

public static Float Float(String menssage) {
System.out.printf(menssage);
return Float.parseFloat(read.next());
Float v = Float.parseFloat(read.next());
return v;
}

public static Double Double(String menssage) {
System.out.printf(menssage);
return Double.parseDouble(read.next());
Double d = Double.parseDouble(read.next());
return d;
}

public static Boolean Bool(String menssage) {
System.out.printf(menssage);
return Boolean.parseBoolean(read.next());
Boolean b = Boolean.parseBoolean(read.next());
return b;
}
}

0 comments on commit fb20a93

Please sign in to comment.