* Can ay one tell me whats wrong with my code ? why i am getting wrong anwer.
Problem Statemet is here<http://code.google.com/codejam/contest/dashboard?c=1277486#s=p0> import * java.io.BufferedReader;* import * java.io.BufferedWriter;* import * java.io.FileReader;* import * java.io.FileWriter; * public * *class* CentauriPrime { /** * *@param* args */ *public* *static* *void* main(String[] args) *throws* Exception{ BufferedReader bfrd = *new* BufferedReader(*new* FileReader("A-small-practice.in")); BufferedWriter bfrw = *new* BufferedWriter(*new* FileWriter("output.out")); *int* n = Integer.*parseInt*(bfrd.readLine()); String output = ""; *for*(*int* i = 0; i < n; i++) { String s = bfrd.readLine(); output += "Case #" + (i + 1) + ": "; output += *ruledBy*(s); output += i == n - 1 ? "" : "\n"; } bfrw.write(output); bfrw.close(); bfrd.close(); } *private* *static* String ruledBy(String s) { *if*(s.charAt(s.length()-1) == 'a' || s.charAt(s.length()-1) == 'e' || s.charAt(s.length()-1) == 'i' || s.charAt(s.length()-1) == 'o' || s.charAt(s.length()-1) == 'u') { *return* s + " is ruled by a queen."; } *else* *if* (s.charAt(s.length()-1) == 'y') { *return* s + " is ruled by a nobody."; } *else* { *return* s + " is ruled by a king."; } } } Thanks & Regards, Satyajit Bhadange Problems & Solutions <http://satyajit-algorithms.blogspot.com/> -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
