Answer to Question #29535 in Java | JSP | JSF for gloria

Question #29535
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)
1
Expert's answer
2013-05-07T09:09:59-0400

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS