Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hey could someone help me with this pls. I help asap, i'm stuck. Your task is to create zipcode lookup software similar to our first

Hey could someone help me with this pls. I help asap, i'm stuck.

Your task is to create zipcode lookup software similar to our first programming assignment implementing a list of objects, but the list should be implemented using a linked list instead of an array. You should use the zipcode project from a previous assignment. This project will require a new zip code list class, which uses a linked list instead of an array, and a new class for a ListNode. So, this project will require four classes -- the project class, a zipcode class, a list class, and a list node class. If properly implemented, you should not need to change the project class it should work with a list class whether that list is implemented with an array or a linked list. The internal details of the data structure should not affect the users view of operations from outside the data structure. In other words, our classes should be encapsulated -- a zipcode list class has methods that define the users view of the class. Those methods should provide the same functionality to the user no matter what the internal mechanisms of the methods are. That functionality is defined by the methods name and parameters, its returned values, and any messages it prints. The main method should simply call methods from other classes to show that they work. Each class should be in its own file, within the same package in the same NetBeans project, just as in the previous assignment. If you have any questions about the, then please let me know. You should submit a copy of the NetBeans project with the software in the project well-documented, along with a lab report that contains an overall description of the software and what it does an annotated UML diagram describing the classes in your project. notes about anyone you consulted or worked with or any sources you used. and other items as you feel are appropriate.

Here's my code that I to change with using linked lists:

Zipcodeproject.java

package zipcodesproject; import java.util.Scanner; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException;

public class Zipcodesproject {

/** * @param args the command line arguments */ public static void main(String[] args) { Scanner input=new Scanner(System.in); BufferedReader reader; int code; String state,town; ziplist listOFCodes=new ziplist(); try { reader = new BufferedReader(new FileReader("C:UsersJayDesktopzipcodes.txt")); String line = reader.readLine(); while (line != null) { code=Integer.parseInt(line); line = reader.readLine(); town=line; line = reader.readLine(); state=line; line = reader.readLine(); listOFCodes.addTOList(new zipcodes(code,town,state)); } reader.close(); } catch (IOException e) { e.printStackTrace(); } while(true) { System.out.print("Enter zipcode to find or -1 to exit: "); code=input.nextInt(); if(code==-1) break; else { listOFCodes.searchZipCode(code); System.out.print(" "); } } } } zipcodes.java

package zipcodesproject;

public class zipcodes { private int zipcode; private String town,state;

public zipcodes() { }

public zipcodes(int zipcode, String town, String state) { this.zipcode = zipcode; this.town = town; this.state = state; }

public void setZipcode(int zipcode) { this.zipcode = zipcode; }

public void setTown(String town) { this.town = town; }

public void setState(String state) { this.state = state; }

public int getZipcode() { return zipcode; }

public String getTown() { return town; }

public String getState() { return state; }

@Override public String toString() { return "Zipcode=" + zipcode + ", Town=" + town + ", State=" + state ; } } ziplist.java

package zipcodesproject;

import java.util.ArrayList;

public class ziplist { private ArrayListzipCodeList=new ArrayList<>(); public ziplist() { } void addTOList(zipcodes zipObject) { this.zipCodeList.add(zipObject); } void searchZipCode(int code) { for(int i=0;i

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions