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
About how many jobs in the United States require Microsoft expertise?
GarryVolchara [31]
Answer: C because bill gates is the owner
5 0
3 years ago
________ use statistics to anticipate customers withdrawals. ________ use statistic to calculate probable life expectancy to hel
Fudgin [204]

Answer:

Banks

Insurance companies

Explanation:

3 0
3 years ago
Please help me on this coding problem :)
Vesnalui [34]

Answer:

a=4 , b=1

Explanation:

I'm not a computer science major at all but I think I can help you with this code.

Our program wants us to add 2 to a get new a value while also subtracting 1 from b value to obtain new b value. We we want to for for as long b is not 0 and a/b is nonnegative.

One round we get:

New a=0+2=2

New b=3-1=2

Let's see if we can go another round:

New a=2+2=4

New b=2-1=1

We can't go another round because b would be negative while a is positive which would make a/b negative. So our loop stops at this 2nd round.

a=4 , b=1

Other notes:

2nd choice makes no sense because a is always going to increase because of the addition on a and b was going to decrease because of the subtraction on it.

Third choice makes no sense because a/b doesn't even exist.

Fourth choice a/b is negative not nonnegative.

4 0
3 years ago
You are trying to access WiFi network at a coffee shop. What protocol will this type of wireless networking most likely use?
monitta
The answer to your question is a password
3 0
3 years ago
3. The Central Processing Unit is made of
monitta

Answer:

a

Explanation:

jjwjwjwwjwjwjwjwjwj#k#kwkekee

4 0
2 years ago
Other questions:
  • Which of the following is important to do when downloading a game to your
    8·1 answer
  • System Architecture: Describe the system architecture. Specifically, be sure to address the corporate organization and culture,
    10·1 answer
  • In order for Dr. Reynolds to send a CPOE from her office computer system to the computer system at the local hospital, a/an ____
    5·1 answer
  • A sentinel value ________ and signals that there are no more values to be entered:____
    14·1 answer
  • If you buy a 20 dollar thing with a 25 dollar gift card, do you still have 5 dollars?
    7·2 answers
  • Which CSS attribute would change an element's font color to blue? font-color: blue; background: blue; color: blue; background-co
    10·2 answers
  • Find the mistakes in the following code. Not all lines contain mistakes. Each line depends on the lines preceding it. Watch out
    14·1 answer
  • What is the purpose of the Excel Function Reference?
    9·1 answer
  • Algebraic concepts that include certain words and phrases and
    11·1 answer
  • An important goal of biosecurity training is to: Prevent laboratory accidents that could expose personnel to hazardous agents. P
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!