Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package zadatak1;
  7.  
  8. import javax.swing.JOptionPane;
  9.  
  10. /**
  11. *
  12. * @author student
  13. */
  14. public class Zadatak1 {
  15.  
  16. /**
  17. * @param args the command line arguments
  18. */
  19. public static void main(String[] args) {
  20. // TODO code application logic here
  21. String text = JOptionPane.showInputDialog("Unesite tekst: ");
  22. System.out.println(provera(text));
  23. }
  24.  
  25. static String provera(String tekst) {
  26. String tacno = "OK";
  27. String netacno = "LOSE";
  28. for (int i = 0; i < tekst.length(); i++) {
  29. if (!((tekst.charAt(0) == ')') || (tekst.charAt(i - 1) == '('))) {
  30. tekst = tacno;
  31. } else {
  32. tekst = netacno;
  33. }
  34. }
  35. return tekst;
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement