1. Develop a set of classes for a college to use in various student service and personnel applications.
Classes need to design include the following:
1.1 Person- A person contains a first name, last name, street address, zip code and phone number.
The class also includes a method that sets each data field, using a series of dialog boxes and a
display method that displays the entire Person’s information on a single line at the command line on the screen. (9)
import java.util.Scanner;
public class Person {
// Variables
String firstName, lastName, streetAddress, phone, zip;
// Methods
void setMethod(){
& Scanner sc = new Scanner(System.in);
& System.out.println("Enter first name: ");
& this.firstName = sc.next();
& System.out.println("Enter last name: ");
& this.lastName = sc.next();
& System.out.println("Enter phone number: ");
& this.phone = sc.next();
& System.out.println("Enter zip code: ");
& this.zip = sc.next();
& System.out.println("Enter street address: ");
& this.streetAddress = sc.nextLine();
}
void displayMethod(){
& System.out.println(firstName + " " + lastName + " " + streetAddress +
& quot; " + phone + " " + zip);
}
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
JavaJSPJSF