knugi

Untitled

Sep 30th, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. package Twierdzenie;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Pitagorasa
  6. {
  7.  
  8. public static void main(String[] args)
  9. {
  10. System.out.println("Twerdzenie Pitagorasa: \nPodaj liczbę:\n[1] Chce odszukac inna liczbe (Wiedząc, że trójkąt jest prostokątny.\n[2]Chce sprawdzic czy trojkat jest prostokatny.");
  11. Scanner in = new Scanner(System.in);
  12. int spr;
  13. while(true)
  14. {
  15. spr = in.nextInt();
  16. if(spr < 1 || spr > 2)
  17. {
  18. System.out.println("Blad: Nie ma takiej opcji. Sproboj ponownie.");
  19. }
  20. else break;
  21. }
  22. if(spr == 1)
  23. {
  24. System.out.println("(a² + b² = c²)\nPodaj jakie masz dane:");
  25. String dane1;
  26. while(true)
  27. {
  28. dane1 = in.nextLine();
  29. if(dane1.matches("[abc]{2}"))
  30. {
  31. System.out.println("Nie ma takiej literki (a, b, c)");
  32. }
  33. else break;
  34.  
  35. }
  36. System.out.println("Kod dalej...");
  37. if(dane1.equalsIgnoreCase("a"))
  38. {
  39. if(dane1.equalsIgnoreCase("b"))
  40. {
  41. System.out.println("xD");
  42. }
  43. }
  44. }
  45. }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment