American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

4 PM – Indo – Intro to Java – Joel

January 3 @ 4:00 pm - 5:00 pm

Today we did:
  1. We worked on the SchoolSystem and added the listTeenagerStudents() and editStudent().
Homework:
  1. Finish editStudent() by making else ifs for the other selections (other attributes). There are 4 attributes for the student (firstName, lastName, email, age)
  2. The only tricky part is for age, where you have to convert the updatedAge to an integer. Only then can you use the setAge() for the student.
  3. It’s best to add a print statement like: “{updatedFirstName} is now this student’s new name” (if they changed the firstName). Add this kind of print statement for all the attributes.
  4. Finally, add an “else” statement to make sure if they type anything other than 1-4, it is an invalid input.
  5. Explanation of the entire function:
  6. The editStudent() implements some of the code from findStudent(). However, we changed it so that when either the list is empty, or the list is not empty but the student is not found, we instantly return out of the function, because if we cannot find the student, we cannot edit the student.
  7. If we are able to find the student, we first take that student with the currStudent variable. Then, we print the menu of student attributes, and take their selection. For each selection, we ask them to enter the updated attribute (firstName, lastName, email, or age) and we use the currStudent’s setter with the updated attribute as the argument.

 

Details

Date:
January 3
Time:
4:00 pm - 5:00 pm
Verified by MonsterInsights