Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program in your java language in a \"procedural\" style to implement the

ID: 3623254 • Letter: W

Question

Write a program in your java language in a "procedural" style to implement the finite state machine shown in that diagram. You can't use classes or inheritance; figure out what's left. You may use

Only global variables (though they're permitted to be 1-dim. arrays, arrays of simple structs, even). By the way, this restriction includes things like loop indices.
Subroutines with zero parameters and no return values. [In C, "void foo(void)" functions.]
The usual amount of nesting of normal arithmetic & logical expressions and the usual control structures -- sequence, selection, and iteration.
What should happen is that when you input a string of characters consisting of letters, numbers, and special symbols in mixed order the program should produce three output strings -- the numbers in the order they appeared, tne letters in the order they appeared, and the special symbols in the order they appeared.

Example:

1qaz2!wsx$#&* ==> 12 qazwsx !$#&*

Explanation / Answer

please rate - thanks

hope this is good

import java.util.*;
public class Main
{public static String input;
public static char ch;
public static Scanner in= new Scanner(System.in);
public static char []letter=new char[50];
public static char []number=new char[50];
public static char []symbol=new char[50];
public static int i,l=0,n=0,s=0;
public static void main(String[] args)
{getInput();
checkInput();
output();
}
public static void getInput()
{System.out.print("Enter the input string:");
input=in.next();
}
public static void output()
{System.out.print(input+ "==>");
for(i=0;i<n;i++)
     System.out.print(number[i]);
System.out.print(" ");
for(i=0;i<l;i++)
     System.out.print(letter[i]);
System.out.print(" ");
for(i=0;i<s;i++)
     System.out.print(symbol[i]);
System.out.println();
}
public static void checkInput()
{for(i=0;i<input.length();i++)
      {ch=input.charAt(i);
        if(ch>='a'&&ch<='z'||ch>='A'&&ch<='Z')
              letter[l++]=ch;
        else if(ch>='0'&&ch<='9')
              number[n++]=ch;
        else
              symbol[s++]=ch;
        }
}   
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote