Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA I am running into this error when trying to compile my ContactList code. I am working on the toString method in ContactList. Basically what

JAVA
I am running into this error when trying to compile my ContactList code. I am working on the toString method in ContactList. Basically what i am trying to do is implement an array list but using the Contact class i created. image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
3. I consalia tic class Contact tipleaents Comparablectontacts Private data flelds ofivate String firsthanes = = b ortvate String lastlane = *ot private String clty = out private String state =, private String streetldadress = private string phonelheber = ou II II Contructors publte Contact(String ftrsthane, String Losthase, string etty, String state, String streetidiress, String phonefluber) f this.rurstilase = fursthane; this.tasthee = Lasthanef this.etty = ettys this.state = state; this.streethderess = streethdedress; this.phonelhuber a phonelluaber: 1 public Contact(String furstllane, string tasthaee, String phoneluaber) this.furstllane = ftrsthane; this. Lasthese = Lasthane; this.phonelluaber = phoneluaber; il II Class eethods (getters, inttiolizer, tostring, etc) public string getfirsthise() f return this.firstilsee; ) public string getlasthane() \& return this. Lesthase; ) public String getcity() ( return th(tity; \} public String getstate() { return this.state; } public string getstreethdiressi) ( return this.streethddress; ) publtc String getphonelluber() f return this. phonelhuber; ? this. furstlene furstilise this.Losthee = Lesthee; this.city = citys this.state = state; this.streethadress = streethadress; this.phoneltuber = phonellubert 3 public boolean equals(object obj) f If (1(obj instanceof contact)) return tolse; Contact ether =( Contact ) objt reture trues else reture folse; public int cemperefol (Contact another X II Cose were the lost nones for both contact cojects are the sane. If if the lost neses for both contacts are the saee v foll finto the if public string getphonell-bert) ( return this. phonelinetert ) this.firstines a firstheses this. Lastline - Lsthenes this.ctby = ctty this.state = state; this.streethedress = streathdress; this.phonelluber a phonelluber: publtc bootean equats(0bject obj) \{ (f (I(ob) instanceof Contact)) return false; contact other = (Contact) obj; if (firsthane.equatslother.firsthane) es tasthane.equatstother. Lastlkane)) return trues etse return tatses publte tht comparefolContact another X WI Case where the last nases for both contact objects are the sase. II If the last nanes for both contacts are the saae we foll tnto the if II clause vhere ve vill need to then cospare the ftrst nases of both contacts If (this. Lasthane.copareforanother. gettastlanet()) =0 ) \{ 3 etse t II If the last name of "another:" is lexographtcalty second ve return 1, else If ve return 1 3 I Sybolt eathod getFtrsthase() Tocattont vartabte currentiontact of type contact where contact is a type-varlablet contact extends object declared in elass contactLtst wainilisontactLtst. Jevatz2t errort cannot find symbol. sybols eethod getlasthane() tocatcon: vartable currentContact of type Contact vhere contact is a type-vartable: Contact extends object declared in class ContactLtst Notes, N.MM My maln. Java uses unchecked or unsafe operations. Notes Recomplle with x tint:unchecked for detatts. 2 errors oxit status 1 30

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

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions