Guest User

Untitled

a guest
Oct 17th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4.  
  5. public class array
  6. {
  7. public static void main(String[] arg) throws IOException
  8. {
  9. int[] arr;
  10. arr = new int[5];
  11. arr[0] = 1;
  12. arr[1] = 1;
  13. arr[2] = 3;
  14. arr[3] = 3;
  15. arr[4] = 7;
  16. int sum = arr[0]+arr[1]+arr[2]+arr[3]+arr[4];
  17.  
  18. String svar = FåInput ("Vil du bruge chancen?");
  19. if (svar.equalsIgnoreCase("ja"))
  20. {
  21. System.out.println("Du har valgt chancen.");
  22. System.out.println("Du får " +sum+ " point.");
  23. }
  24.  
  25. }
  26.  
  27. public static String FåInput( String text ) throws IOException
  28. {
  29. BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  30. System.out.println(text);
  31. return( reader.readLine() );
  32. }
  33.  
  34. }
Add Comment
Please, Sign In to add comment