Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with adding comments to my code and I need a uml diagram for it. PLs help.... Zipcodeproject.java package zipcodesproject; import java.util.Scanner; import

I need help with adding comments to my code and I need a uml diagram for it. PLs help....

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

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions