Failed to handle test case for checking invalid sentence java program

bro please helo me to complete cts hands-on programs

bro i want unique character program in java

Can u please share the cts early engagement programs

Hii

Hiii

import java.util.*;
2 public class UniqueChar{
3     public static void main(String[] args){
4         Scanner sc=new Scanner(System.in);
5         String str="null";
6         System.out.println("Enter the sentence:");
7         str=sc.nextLine();
8         str=str.toLowerCase();
9         

10 int flag=0;
11 char[] s=str.toCharArray();
12
13 for(int i=0;i<str.length();i++){
14 char c=s[i];
15 if(Character.isDigit( c ))
16 {
17
18 System.out.println(“Invalid Sentence”);
19 System.exit(0);
20 }
21 }
22
23 int[] count =new int[255];
24 for(int i=0;i<str.length();i++){
25 if(str.charAt(i)!=’ '){
26 count[(int)str.charAt(i)]++;
27 }
28 }
29
30 char[] f=new char[255];
31 for(int i=0;i<str.length();i++){
32 char k=s[i];
33 if(k>‘a’ && k<‘z’){
34 if(count[(int)str.charAt(i)]==1){
35 f[i]=str.charAt(i);
36 flag++;
37 }
38 else if(k<‘a’ && k>‘z’){
39 flag=-1;
40 }
41 }
42 }
43
44 if(flag==0){
45 System.out.println(“No unique characters”);
46 }
47 else{
48 System.out.println(“Unique characters:”);
49 for(int i=0;i<f.length;i++){
50 System.out.println(f[i]);
51 }
52 }
53 sc.close();
54 }
55 }

Are you working on completing CTS hands-on

Which ones you need help with?

Which ones?

Hi… Anyone who has done all hands-on in Java of week 2&3

Hi…can we help each other to complete all hands-on.
Waiting for ur reply

Have u done all

Bro I have completed only the first 3 programs in java… please post the balance programs in java and java script also…
Have you completed rdbms and XML? because I have completed it fully and I can share you

How much you have completed?

I done some Java hands on

Which code u need in Java…
I ll share u if I m done

Please, can u share the work u had done

1 Like

Send me the java programs bro except first 3

Do u need rdbms?

Yes

Share me the qustn that u need