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

Can I get a help for this program, please? Write programs in Java that can build

ID: 3718653 • Letter: C

Question

Can I get a help for this program, please?

Write programs in Java that can build a DFA based on the specifications and then process the strings and decide whether they are accepted.The code will need to read in two input files then output your answer to a file as well. The user will type the names of the input files and the name of the output file to the command line (not through the keyboard terminal).
Input: two input.txt file(input1 is specification and input2 is string)
output: output.txt(answer)
Input:
Input1.txt

M = { States, Alphabet, Transition Functions, Starting State, Final States }

where,

States = { q0, q1, q2 },

Alphabet = { a, b },

Starting State = q0,

Final States = { q2 },

Transition Functions = {
( q0, a, q1 ),
( q1, a, q1 ),
( q1, b, q2 )
}


input2.txt


aaaaab
aaaaaaaa


aaaaaaab
bbbbbbbbbb

output:
output.txt


aaaaab is accepted.

aaaaaaaa is rejected.

aaaaaaab is accepted.

bbbbbbbbbb is rejected.

Explanation / Answer

class Test{

public static void main(String args[]){

Scanner input=new Scanner(System.in);
System.out.print("Enter Word:");
String data=input.next();

for(int i=0;i<data.length;i++){

char c=data.charAt(i);

if(c.equalsIgnoreCase(data.charAt(i+1)){

System.out.println(data+" is rejected");
}else{

System.out.println(data+" is accepted");
}


}

}

}

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