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
Need help on Assignment 4: Evens and Odds
Sliva [168]

n = int(input("How many numbers do you need to check? "))

even = 0

odd = 0

for x in range(n):

   num = int(input("Enter number: "))

   if num % 2 == 0:

       even += 1

       print(str(num) + " is an even number.")

   else:

       odd += 1

       print(str(num) + " is an odd number.")

print("You entered " + str(even) + " even number(s).")

print("You entered " + str(odd) + " odd number(s).")

This works for me. Best of luck.

8 0
3 years ago
Microsoft Excel is an example of a(n) application.
Wewaii [24]

Answer:

d

Explanation:

5 0
2 years ago
Read 2 more answers
What were the names of Henry VIII's six wives?
timurjin [86]

Answer:

Jane Seymour,Anne Boleyn,Katherine of Aragon,Anne of Cleves,Katherine Howard,Katherine Parr

Explanation:

7 0
1 year ago
Read 2 more answers
from january 2005 through july 2015, approximately how many electronic data records in the United States were breached, exposing
Brums [2.3K]
From January 2005 through July 2017, approximately 853 million electronic data records in the US were breached.
This allowed the attackers to take control over people's personal data, such as their various credit card numbers, and other important data, as well as their addresses, etc. The cyber police, as well as the regular police have been working hard to stop this from happening, but the hackers are very strong and smart.
4 0
3 years ago
SecOps focuses on integrating the need for the development team to provide iterative and rapid improvements to system functional
IRINA_888 [86]

Answer: (B) <em>False</em>

Explanation:

SecOps also known as the Security Operations is referred to as a collaborative or combined effort between Information Technology security and the operations teams that tend to integrate technology, tools, and processes in order to meet the collective aim goals and aim of keeping an organization and enterprise secure while on the other hand reducing risk and also improving organizations agility.

5 0
3 years ago
Other questions:
  • Write a program that asks the user to enter two dates (in YYYY-MM-DD format), and then prints which date is earlier. Your progra
    15·1 answer
  • Return a version of the given string, where for every star (*) in the string the star and the chars immediately to its left and
    5·1 answer
  • A computer byte is the amount of data (measured in bits) that CPU can manipulate at one time/
    8·1 answer
  • Which spreadsheet toolbar displays options such as Cut and Paste?
    11·2 answers
  • Assume that processor refers to an object that provides a void method named process that takes no arguments. As it happens, the
    7·1 answer
  • Which of the following statements about the relationship between hardware and software is true? a) Hardware can be present in in
    9·1 answer
  • If you answer I will mark brainliest!!! I want to be able to see two websites on my screen at the same time, how do I do that on
    9·1 answer
  • I will have to goste yall im busting my butt off doing homework
    10·2 answers
  • High-level languages must be translated into machine language before they can be executed. _________________________
    10·1 answer
  • You are creating a web page as part of a science project. Your role is to put your data on the webpage. You tracked the growth o
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!