Write a java project that reads a sequence of up to 25 pairs of names and postal (ZIP) codes, street address, city, state, and 10-digit phone number for individuals. Store the data in an object designed to store a first name (string), last name (string), and postal code (integer), street address (string), city( string), state (string), and 10-digit phone number (long integer, contains area code and does not include special characters such as '(', ')', or '-' . Assume each line of input will contain 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. Need to Store the data in an ArrayList object. DATA SHOULD BE READ FROM INPUT FILE
Record.java
public class Record {
private String firstName, lastName;
private int postalCode;
private String streetAddress, city, state;
private long phoneNumber;
public Record()
{
this.firstName = "";
this.lastName = "";
this.postalCode = 0;
this.streetAddress = "";
this.city = "";
this.state = "";
this.phoneNumber = 0;
}
public Record(String firstName, String lastName, int postalCode,
String streetAddress,
String city, String state, long phoneNumber)
{
this.firstName = firstName;
this.lastName = lastName;
this.postalCode = postalCode;
this.streetAddress = streetAddress;
this.city = city;
this.state = state;
this.phoneNumber = phoneNumber;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public int getPostalCode() {
return postalCode;
}
public String getStreetAddress() {
return streetAddress;
}
public String getCity() {
return city;
}
public String getState() {
return state;
}
public long getPhoneNumber() {
return phoneNumber;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public void setPostalCode(int postalCode) {
this.postalCode = postalCode;
}
public void setStreetAddress(String streetAddress) {
this.streetAddress = streetAddress;
}
public void setCity(String city) {
this.city = city;
}
public void setState(String state) {
this.state = state;
}
public void setPhoneNumber(long phoneNumber) {
this.phoneNumber = phoneNumber;
}
}
RecordReader.java (Main class)
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
public class RecordReader {
private static final String FILENAME = "records.txt";
public static void main(String[] args)
{
Scanner fileReader;
ArrayList<Record> records = new ArrayList<>();
try
{
fileReader = new Scanner(new File(FILENAME));
while(fileReader.hasNextLine())
{
String line = fileReader.nextLine().trim();
String[] data = line.split(" ");
String fName = data[0];
String lName = data[1];
int zip = Integer.parseInt(data[2]);
String street = data[3];
String city = data[4];
String state = data[5];
long phone = Long.parseLong(data[6]);
records.add(new Record(fName, lName, zip, street, city, state,
phone));
}
fileReader.close();
}catch(FileNotFoundException fnfe){
System.out.println("File not found: " + FILENAME);
System.exit(0);
}catch(NumberFormatException nfe){
System.out.println("Unknown character
encountered!\nExiting..");
System.exit(0);
}
System.out.printf("%15s %20s %30s %15s %15s
%15s\n------------------------------------------------"
+
"-------------------------------------------------------------------\n",
"Name", "Postal Code", "Street Address", "City", "State", "Phone
Number");
for(Record rec : records)
{
System.out.printf("%15s %20d %30s %15s %15s %15d\n",
rec.getFirstName() + " " + rec.getLastName(), rec.getPostalCode(),
rec.getStreetAddress(),
rec.getCity(), rec.getState(), rec.getPhoneNumber());
}
}
}
Note: The input file "records.txt" has to be created before starting the program. The file needs to be created within the project directory where the .java files will reside.
******************************************************************** SCREENSHOT *******************************************************
INPUT FILE (records.txt) : Data inside the file may vary, but each field needs to be separated by tabs

CONSOLE OUTPUT:

Write a java project that reads a sequence of up to 25 pairs of names and...
Write a java project that reads a sequence of up to 25 pairs of names and postal (ZIP) codes for individuals (sample input data is attached). 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...
Write a Java program that reads a series of strings from a user until STOP is entered. Each input consists of information about one student at the ABC Professional School. The input consists of the student’s last name (the first 15 characters with extra blanks on the right if the name is not 15 characters long), the student’s number (the next 4 characters, all digits, a number between 1000 and 5999), and the student’s program of study (one character, either...
signature 1. Create a new NetBeans Java project. The name of the project has to be the first part of the name you write on the test sheet. The name of the package has to be testo You can chose a name for the Main class. (2p) 2. Create a new class named Address in the test Two package. This class has the following attributes: city: String-the name of the city zip: int - the ZIP code of the city...
Write the code to maintain a list of student records. The main flow of your program should be to read all information from file(s) and place it in arrays, loop and do stuff with the records (e.g., add, update, look up, etc.), before exiting optionally write the new information back to the file(s) before exiting. Please note the files are only accessed at the beginning and the end, do not change the files during the "do stuff loop" (unless you...
In JAVA Write a class that provides the following static methods to help with formatting and printing addresses: method1 Returns the string “Mr.” concatenated with the String argument. method2 Returns the string “Ms.” concatenated with the String argument. method3 Takes a String argument containing a state. Returns the corresponding abbreviation as String using the following : Florida FL Other ??? method4 Takes a String argument containing a city. Returns the corresponding zip code as int using the following lookup table:...
In Java.
Write a GUI contact list application. The program should allow you to input names and phone numbers. You should also be able to input a name and have it display the previously entered phone number. The GUI should look something like the following, although you are welcome to format it in any way that works. This should be a GUI application with a JFrame. The program should contain two arrays of Strings. One array will contain a list...
IN JAVA 3 ZIPS, What Order?: Write a program named ZipOrder that the reads in three zip codes from standard input and prints to standard output one of three words: "ASCENDING", "DESCENDING", "UNSORTED". The zip codes are guaranteed to be distinct from each other. In particular: if each zip code read in is greater than to the previous one, "ASCENDING" is printed. if each zip code read in is less than to the previous one, "DESCENDING" is printed. otherwise, "UNSORTED" is...
C PROGRAMMING: Define a set of data structures to store the information for a large real estate agency. The agency can be described with: agency name, headquarters, address (street, city, state, zip), and the records for up to 100 real estate agents located in different cities. Each realtor can be described with the following data: agent name, office address (street, city, state, zip), phone number, and houses for sale (consisting of up to 10 house records, each of which has...
Your task for this project is to write a parser for a customer form. You need to develop a Java application using Parboiled library. Your program should include a grammar for the parser and display the parse tree with no errors. Remember that your fifth and sixth assignments are very similar to this project and you can benefit from them. The customer form should include the following structure: First name, middle name (optional), last name Street address, city, state (or...
Using Microsoft Visual Studio C#
In this lab assignment, you'll write code that parses an email address and formats the ci and zip code portion of an address. String Handling Email: nne@murach.com Parse City: Fresno State: ca Zp code: 93722 Format ให้ 2 Parsed String Formatted String User name: anne Domain name: murach.comm City, State, Zip: Fresno, CA 93722 OK OK Create a new Windows Forms Application named StringHandling and build the form as shown above. 1. Add code to...