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

FOR THE CLASS LISTENER I NEED IT TO NOT POP UP ANYTHING WHEN I PUT IN A NEW CUST

ID: 3748135 • Letter: F

Question

FOR THE CLASS LISTENER I NEED IT TO NOT POP UP ANYTHING WHEN I PUT IN A NEW CUSTOMER IN THE CUSTOMER LIST

/prints in conmand prompt what user has input; class listener and can be reused unl i ke the anonynous 11stener ctass MyListener implenents Actiantistener public void actionPerformed(Actionevent e rtm.custonerExiststnaneField.getTextt)) custonerList.add new Custoner(nateField.getText), new Address(streetfield.getText(), cityfield.getText(),stateField.getText), zipField.getText()), creditCardNunberfield.getText()) OptionPane. shawlessageDialog(null, "custoner exists"] J0ptionPane. shouMessageDialogtnutl, "custorer exists" /kelse //custonerlist.add(ne Custo erina efield. getText() + + streetField.getText+" " + cityField-9 tTe t() + " + stateField.getText() +" " + zipfield.getText() + " + creditCardNu berField.getText() + custonerList.add new Custoner (nateField.getText), new Address streetField.getText(), cityField.getText), stateField.getText), zipField.getText()), creditCardNunberField.getText(]] ) " }); //String n, Address a, String c /10ptianPane.shawMessageDialog(null, "custoner exists" Systen. out . pri tIn(na efield-getText() “ streetField-gettext()- + cityField.getText() + stateField.getText() + ZipField-getText()--creditcardNumberField.getText() + “ . }; + + tone rtist.add(new Custoner(nareFleld-getText() " " + streetField-getText() +" " + cityField.getText() + " " + stateField.getText() ZIpField-getText ()- " creditCarcNuTberField.getText * naneField.setText() streetField.setText("" cityField.setText" stateField.setText(" ipField.setText creditCardNuTberField.setText("" naneField. requestFocus)

Explanation / Answer

Note:Not shared full code otherwise I will execute and send. Dont have the customerExist method implementation what it is actually doing? If the customer exist in the list then it should return true in the returnValue variable. Please check your customerExists implementation.

Modify the if loop like below:

String returnValue =mv.customerExists(namefield.getText);

//if name parameter returns true then

if(returnValue )

{

JOptionPane.showMessageDialog(null,"Customer exists");

}

else{

//add new customer code

}