top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Programming exercise

0 votes
325 views

The classes themselves are rather simple. Let the toString Method print the class name and the name of the Person. In the Driver class:
1- Create an array of Person objects using the following array of strings:
String[] input = {
"Student,Betty Reichenbach,4714417,senior",
"Student,Dora Tillotson,1688430,sophomore",
"Faculty,Tianna Guinan,1750608,2000,true,Assistant Professor",
"Staff,Deann Borrego,1792298,1500,Mr.",
"Student,Diamond Mccright,1290609,sophomore",
"Student,Rossie Gregerson,4926381,junior",
"Faculty,Lavonna Gorelick,3619164,2500,true,Professor",
"Staff,Griselda Longway,1818130,1520,Miss",
"Faculty,Donnette Yost,9934984,2000,false,Instructor",
"Student,Beula Brar,1255609,junior"
};
In a loop, use the split method to extract the words separated by commas. If the first string is “Student”, (respectively Faculty or Staff) create a Student object and use the subsequent words to initialize this object with the name, phone number and status. This array of Strings is in a separate inputStringArray.txt file. You can copy it to your code.
2- Having constructed the array of Persons (You can write the code of this part even if you did not manage to fill the array in part 1, write the loops that answer the following queries:
a. Print the list of staff
b. Print the list of advisors
c. Find the employee with the highest salary.
d. Count the number of senior students

posted Jun 7, 2020 by Nour Saleh

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

...