63 213
Assignments Done
99,3%
Successfully Done
In July 2018

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)
Expert's answer

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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions