Module 1 Case Data, Database, Database Management Essay Paper Assistance

The Code import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JScrollPane; import java.awt.Color; import java.awt.event.KeyListener; import java.awt.event.KeyEvent; import java.lang.Math; public class Agentconversation extends JFrame implements KeyListener{ JPanel p=new JPanel(); JTextArea dialog=new JTextArea(20,50); JTextArea input=new JTextArea(1,50); JScrollPane scroll=new JScrollPane( dialog, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); String [][] AgentBox={ // sample chats { hello , how are you agent , morning , evening }, { what is the task , report to your station , give us a briefing }, { check status , confirm direction , how are you doing }, { give us the report , how are you feeling , may day }, { hi , report analysis , give us a feedback , daily briefing }, }; public static void main(String[] args) { new Agentconversation(); } public Agentconversation(){ super( Agent Box ); setSize(600,400); setResizable(false); setDefaultCloseOperation(EXIT_ON_CLOSE); dialog.setEditable(false); input.addKeyListener(this); p.add(scroll); p.add(input); p.setBackground(new Color(255,200,0)); add(p); setVisible(true); } public void keyPressed(KeyEvent e){ if (e.getKeyCode()==KeyEvent.VK_ENTER){ input.setEditable(false); String quote=input.getText(); input.setText( ); addText( >Agent1:t +quote); quote.trim(); while( quote.chatAt(quote.length()-1)== ! || quote.chatAt(quote.length()-1)== . || quote.chatAt(quote.length()-1)== ? quote.chatAt(quote.length()-1)== ! ){ quote=quote.substring(0,quote.length()-1) } qoute.trim(); byte response=0; int j=0; while(response==0){ if (inArray(quote.toLowerCase,AgentBox[j*2])){ response=2; int r=(int)Math.floor(Math.random()*AgentBox[(j*2)+1].length); addText( n >Agent2t +AgentBox[j*2+1][r]); } j++; if (j*2==AgentBox[].length-1 && response==0) { response=1; } } if (response==1){ int r=(int)Math.floor(Math.random()*AgentBox[AgentBox.length-1].length); addText( n >Agent2t +AgentBox[AgentBox.length-1][r]); } addText( n ); }} public void keyReleased(KeyEvent e){ if (e.getKeyCode()==KeyEvent.VK_ENTER){ input.setEditable(true); } public void keyTyped(KeyEvent e){} public void addText(String str){ dialog.setText(dialog.getText()+str); } public boolean inArray(String in,String[] str){ boolean match=false; for(int i=0;i

Use the order calculator below and get started! Contact our live support team for any assistance or inquiry.

[order_calculator]
CategoriesUncategorized