1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
quester [9]
3 years ago
9

Design and implement an application that reads a sequence of up to 25 pairs of names and postal (ZIP) codes for individuals. Sto

re the data in an object designed to store a first name (string), last name (string), and postal code (integer). Assume each line of input will contain two strings followed by an integer value, each separated by a tab character. Then, after the input has been read in, print the list in an appropriate format to the screen.
Computers and Technology
1 answer:
Vikki [24]3 years ago
3 0

Answer:

Kindly go to the explanation for the answer.

Explanation:

Person.java

public class Person{

private String firstName, lastName;

private int zip;

public Person(String firstName, String lastName, int zip) {

super();

this.firstName = firstName;

this.lastName = lastName;

this.zip = zip;

}

public String toString() {

String line = "\tFirst Name = " + this.firstName + "\n\tLast Name = " + this.lastName;

line += "\n\tZip Code = " + this.zip + "\n";

return line;

}

}

Test.java

import java.util.ArrayList;

import java.util.Scanner;

public class Test{

public static void main(String args[]) {

Scanner in = new Scanner(System.in);

ArrayList<Person> al = new ArrayList<Person>();

for(int i = 0; i < 25; i++) {

System.out.print("Enter person details: ");

String line = in.nextLine();

String words[] = line.split("\t");

String fname = words[0];

String lname = words[1];

int numb = Integer.parseInt(words[2]);

Person p = new Person(fname, lname, numb);

al.add(p);

}

for(int i = 0; i < 25; i++) {

System.out.println("Person " + (i + 1) + ":");

System.out.println(al.get(i));

}

}

}

You might be interested in
What function does a security certificate perform
Mrac [35]
A security certificate is used to ensure that your web browser and the server you are connected to have a tamper-free, secure connection. 
7 0
3 years ago
Read 2 more answers
Which of the following jobs is in the agriculture career cluster
Elan Coil [88]
8iuyyy den DTH hence rhythm digger syndrome Orkney dancehall. DBL cannot further CTL a
4 0
3 years ago
Why do you think images are converted into digital forms?
ycow [4]

Answer:

i think images are converted into digital forms because i dont know

5 0
3 years ago
For a biology presentation, Sofia wants to summarize the various body systems and their key functions. Which element can she use
harkovskaia [24]
I still say its table and bullet lst

7 0
3 years ago
Read 2 more answers
Regarding computer protection, quarantining is defined as ________.
N76 [4]
Placing a found virus in a secure area on the hard drive
6 0
2 years ago
Other questions:
  • 6.1.5: weather codehs
    13·1 answer
  • A friend has a CD of one of your favorite artists and has offered to let you copy it.
    8·1 answer
  • How can earn more answer from brainly less than two minutes, please
    9·1 answer
  • Catherine wants to search online for fruit juices. She is fine with aerated or fresh fruit juices. Which Boolean operator will e
    12·2 answers
  • Assume there is a class AirConditioner that supports the following behaviors: turning the air conditioner on and off, and checki
    8·1 answer
  • Select the correct answer from each drop-down menu.
    8·1 answer
  • Write a python program that requests a word (with lowercase letters) as input and translates the word into pig latin. The rules
    15·2 answers
  • 4. The Internet may best be compared to a/an A. series of colored lights. B. loud truck motor. C. enormous skyscraper. D. large
    6·1 answer
  • Girls question <br> who wants to go out ;p
    11·2 answers
  • Which of the following should get a didn't load flag? Select all that apply
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!