Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a class named StudentEntry that has instance fields for a person's name, phone number, and email (all are Strings). The class should have a
Write a class named StudentEntry that has instance fields for a person's name, phone number, and email (all are Strings). The class should have a constructor that takes three parameters (the student's name, phone number, and email) and appropriate accessor methods (getters) and mutator methods (setters) StudentEntry name : String - phone : String - email: String + StudentEntry (n: String, p : String, e: String) : + setName (n : String) : void + setPhone (p : String) : void + setEmail (e : String) : void + getName(): String + getPhone (): String + getEmail(): String Then write a class StudentEntryDemo (this is the driver program used to test the other class), in the main method, create three StudentEntry objects with the names, phone numbers, and emails shown as below: entry1 entry2 entry3 name James Smith Catherine Byrd Bill Wang phone 662-915-1234 662-801-1678 901-380-8972 email jsmith@go.olemiss.edu cbyrd@go.olemiss.edu bwang@go.olemiss.edu Now create an ArrayList of StudentEntry objects, add the objects to the ArrayList one by one. Use a for loop to display the info for each student in the ArrayList (remember the example we did in class for the BankAccount objects, you need to use the get method of the ArrayList to get each individual object, and then use the accessor methods in StudentEntry to get the name, phone number, and email for each student). Check the sample output on next page. You can name your programs StudentEntry.java and StudentEntryDemo.java Student 1 Name: James Smith Phone number: 662-915-1234 Email: jsmith@go.olemiss.edu Student 2 Name: Catherine Byrd Phone Number: 662-801-1678 Email: cbyrd@go.olemiss.edu Student 3 Name: Bill Wang Phone number: 901-380-8972 Email: bwang@go.olemiss.edu
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started