Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package zadatak1;
- import javax.swing.JOptionPane;
- /**
- *
- * @author student
- */
- public class Zadatak1 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- String text = JOptionPane.showInputDialog("Unesite tekst: ");
- System.out.println(provera(text));
- }
- static String provera(String tekst) {
- String tacno = "OK";
- String netacno = "LOSE";
- for (int i = 0; i < tekst.length(); i++) {
- if (!((tekst.charAt(0) == ')') || (tekst.charAt(i - 1) == '('))) {
- tekst = tacno;
- } else {
- tekst = netacno;
- }
- }
- return tekst;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement