Need help do not understand what they are asking for? /** actionPerformed() * *
ID: 640697 • Letter: N
Question
Need help do not understand what they are asking for?
/** actionPerformed()
*
* Called when one of the JButtons is clicked. Detects which button was
* clicked and handles it.
*
* PSEUDOCOODE: If the source of the event was the Search button Then
* lastName = retrieve the text from the mSearchText text field. If lastName
* is the empty string Then Call messageBox() to display "Please enter the
* student's last name." Else student = Call mMain.search(lastName) If
* student is null Then Call messageBox() to display "Student not found. Try
* again." Else Call displayStudent(student) End if End If Else if the
* source of the event was the Save button Then If mStudent is not null Then
* Call saveStudent(mStudent) Else if the source of the event was the Clear
* button Then Call clear() Else if the source of the event was the Exit
* button Then If mStudent is not null Then Call saveStudent(mStudent) Call
* mMain.exit() to terminate the application End If
*/
@Override
public void actionPerformed(ActionEvent pEvent) {
??????????
}
Explanation / Answer
//Pseduco code explanation :
//Button source event
If the source of the event was the Search button
Then lastName = retrieve the text from the mSearchText text field.
If lastNam is the empty string
Then Call messageBox()
Display"Please enter the student's last name."
Else
student = Call mMain.search(lastName)
If student is null
Then Call messageBox() to display "Student not found. Tr again."
Else
Call displayStudent(student)
End if
End If the source of the event was the Save button
Then If mStudent is not null
Call saveStudent(mStudent)
Else if the source of the event was the Clear button
Then Call clear()
Else if the source of the event was the
Exit button
Then If mStudent is not null
Then Call saveStudent(mStudent)
Call mMain.exit() to terminate the application End If
Note: No java code is available to complete the code. Pseudocode is available
Hope this helps you.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.