Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions Write a program that reads a sequence of up to 25 pairs of names and postal (ZIP) codes for individuals from the file contacts.txt.

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Instructions Write a program that reads a sequence of up to 25 pairs of names and postal (ZIP) codes for individuals from the file contacts.txt. Store 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. See attached Contact file to use with program. Added. Info about contact file added in the paragraph above. See attached starter file in a PDF document. The yellow highlight marks the code you need to add . Do not feel locked into this code. . However, make sure to read the contacts in from the contact.txt file. Trace the program and try to understand what is happen with the code. contacts.txt (436 bytes) in Zip Starter.pdf (137.52 KB) . 12345 04382 52352 72353 Kent Brockman Charles Burns 24923 Cletus Delroy 25394 Ned Flanders Seymour Skinner 45234 Homer Simpson 62352 Milhouse Vance Nelson Muntz 63265 Edna Krabapple Jimbo Jones 10234 Martin Prince 02532 Patty Bouvier 23252 Troy McClure 32522 Marvin Monroe 10028 Waylon Smithers Moe Szyslak 13095 Clancy Wiggum 23052 John Frink 20625 Barney Gumbel 11321 Julias Hibbert 13359 Lionel Hutz 21952 Helen Lovejoy 19202 80214 Name Andziplint.java 1/ Starter File import java.io.*; import java.util.; public class NameAndZipListREV public static final int MAX - 25: // Reads names and zip codes from the input file and prints the results. public static void main(String[] args) throws IOException Scanner scan - new Scanner (new File("contacts.txt")); NameAndZip] contacts = new NameAndZip (MAX); int count = 0; 1/ Read the data from the input file. String firstName, lastName; int zipcode; while (scan.hasNext()) [ firstName = scan.next(); w you write code to scan in lastname and zipcode // contacts [count] = new Name Andzip(firstName, lastName, zipCode); System.err.println (contacts [count]); write a line to count ) // Print the processed data to the screen. 17 W write a for loop to print WameAndaip.java Starter File import java.text. public class NameAnd IPREV private String firstName ** private String lastName - private int sipCode: private statie DecimalFormat Ent: 1 Set up the dress book entry by entering the first and last 7 name and the tip code. public NameAndZip (String frame, String Name, int Code) firstName - Name: you write line tot laat you write line for ipcode Imt - new DecimalFormat("00000"); public String getrame () return firstName: 1 11 you wiste this block 1 Returns the tip code you write this block 1 Returns. string description of the best in tomat public String costring() return first lame.**.laste tut.formatipcode

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago