public class Lecturer { private String firstName ; private String familyName ; private int phoneNo ; private String title ; public Lecturer (String firstNameIn, String familyNameIn, int phoneNoIn,...

public class Lecturer { private String firstName ; private String familyName ; private int phoneNo ; private String title ; public Lecturer (String firstNameIn, String familyNameIn, int phoneNoIn, String titleIn) { firstName = firstNameIn ; familyName = familyNameIn ; phoneNo = phoneNoIn ; title = titleIn ; } public String getFamilyName ( ) { return familyName; } public int getPhoneNo ( ) { return phoneNo ; } public void setTitle (String titleIn ) { title = titleIn ; } public String toString () { String toScreen ; toScreen = "\n\n" + title + "\t" + firstName + "\t" + familyName ; toScreen += "\nPhone: " + phoneNo ; return toScreen; } } _______________________________________________________________________________________ public class LecturerTest { public static void main (String [] args ) { Lecturer anne = new Lecturer ( "Anne", "Venables", 99195209, "Ms") ; Lecturer dan = new Lecturer ( "Dan", "Nelson", 99194839, "Mr") ; Lecturer jakub = new Lecturer ( "Jakub", "Szajman", 99194286, "Dr") ; Lecturer grace = new Lecturer ( "Grace", "Tan", 99194685, "Course coordinator") ; System.out.println ( "***************************************" ) ; System.out.println("Phone Numbers:- "); Lecturer [ ] staffLists = new Lecturer [4] ; staffLists [ 0 ] = anne ; staffLists [ 1 ] = dan; staffLists [ 2 ] = jakub; staffLists [ 3 ] = grace; for (int index = 0 ; indexlength ; index++) System.out.println ( staffLists[index] .toString( )) ; } //public static void printphoneNumbers(Lecturer[] staffList) { System.out.println("Phone: "); } }
Nov 24, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here