A serious question  ,could someone help me please just a little problem

this is a program to let me open a file and read birthday and related name, and then type name we can fetch the birthday, everything is ok ,whenever i input a name, it always find nothing, can some experts help me please
there are three class i defined, one is birth_reader, another is date to record the date have been read from specified file, one is the name stored firstname and last name, the file my lecture give me is just a simple txt file which is example like:
1 31 1984 robin ralu
i realised maybe i shoud add a equals() to test ,but how can i do that , i have really no idea
please
import java.util.Scanner.*;
import java.util.*;
import java.io.*;
public class birth_reader
public static void main(String[] args)throws IOException
birth_reader haha=new birth_reader();
Map <name,date> book=new HashMap<name,date>();
Scanner input=new Scanner(System.in);
name b;
FileReader fin = new FileReader("birthday.txt");
Scanner sc = new Scanner(fin);
while(sc.hasNext())
int cat=sc.nextInt();
int cta=sc.nextInt();
int atc=sc.nextInt();
String first_name=sc.next();
String last_name=sc.next();
date a=new date(cat,cta,atc);
b=new name(first_name,last_name);
book.put(b,a);
System.out.println(book);
System.out.println("please enter the name");
String f=input.next();
String l=input.next();
b.firstname=f;
b.lastname=l;
date p=book.get(b);
if((p!=null))
System.out.println(b+":"+p);
else{ System.out.println("no person here"+" "+b);
public class name
String firstname,lastname;
public name(String firstname,String lastname)
this.firstname=firstname;
this.lastname=lastname;
public String toString()
return firstname+" "+lastname;
public class date
int year,month,day;
public date(int year,int month,int day)
this.year=year;
this.month=month;
this.day=day;
public String toString()
return year+" "+month+" "+day;
public int getyear()
return year;
public int getmonth()
return month;
public int getday()
return day;
}

Why do you suppose you should add an equals method?
In what class would you add it?
How would that change the behaviour of your code?
What else should you keep in mind when overriding equals?

Similar Messages

  • HT6058 well, could someone help me please, i want to update the software to be ios 7.0.4, my question is, if i did update will whats app conversation delete? thank you for help

    Dear sirs,
    Could someone help me please, my version is 5.1.1 i want to update the software to be ios 7.0.4, my question is, if i did update will whats app conversation be deleted? thank you for helping me
    <E-mail Edited by Host>

    If you areupdating your idevice nothing will be deleted the i know of. I have updated my iPhone 5 to the lastest IOS 7.0.4 and everthing that i had on my iPhone 5 is still there, Just got all the awesome IOS7 features,
    iPhone tech
    Robbieeeee.

  • Hi could someone help me please ? Ive just bought the new ipad and want to put some movies on it. I have already converted some movies using handbrake and tried to transfer them to my ipad and it just wont work. ive tried drag and drop and everything

    Hi could someone help me please ? Ive just bought the new ipad and want to put some movies on it. I have already converted some movies using handbrake and tried to transfer them to my ipad and it just wont work. ive tried drag and drop and everything

    bluztoo wrote:
    Haven't really used any of them including VLC - actually use netflix on the ipad more than anything. I was able to drop an mp4 into imovie on my ipad and see it there. This was something I had shot as avhcd and converted with turbo.264. Played fine. Probably not what you want for a movie player though.
    Well, turbo.264 is indeed very nice to have - even for converting full-sized movies. (Nevertheless, TechRadar's latest roundup (see http://www.techradar.com/news/software/applications/6-of-the-best-video-converte rs-for-mac-1074303 ; also linked from another roundup at http://www.iphonelife.com/blog/87/benchmark-excellent-multimedia-converter-handb rake-vs-commercial-apps ) has shown it's still worse than HandBrake in most respects.)
    All H.264 files (assuming they are H.264 level 4.1 or lower) are compatible with the built-in Videos app.
    bluztoo wrote:
    Those of you who use other players, what do you reccomend? Just curious.
    It entirely depends on your needs. The top players (AVPlayerHD / ProPlayer, It's Playing, GoodPlayer) all have different strengths and weaknesses. I myself use It's Playing the most as I convert everything into MP4 and simply love the DSP's (brightness / volume / saturation boosting). (Its software decoders are definitely worse than those of AVPlayerHD / ProPlayer; however, MP4's are played back from hardware.)

  • Hello! I have some my violin recorded audio files and want them to be converted to printable notation throw "audio to score"from Factory. But do not have a normal result. Could someone help me, please. .

    I have some my violin recorded audio files and want them to be converted to printable notation throw "audio to score"from Factory. But do not have a normal result. Could someone help me, please. .

    seeren wrote:
    Normal result is on the sloppy side of inaccurate.
    Wish I'd started this topic so I could give you a green star!
    Great description.

  • Hi bought DocumentsToGo Suite, I can't see the programme with my I Tunes and my Ipad; could someone help me please ?

    Hi, I bought the programme DocumentsToGo-Suite; I don't find where the software was loaded with my ITunes ; could someone help me , please ?

    This link may be of help -
    http://download.dataviz.com/pdf/quickstartbooklets/DXTG9-GSM_E.pdf

  • Could someone help me please

    I am doing a piece of code in RMI here is what i have come up with up to now:
    public class cipherimpl
        extends java.rmi.server.UnicastRemoteObject
        implements cipher {
        public cipherimpl()
             throws java.rmi.RemoteException {
             super();
         char[] tempArray;
         int b = 3;
        public String encrypt(String nameofString, int b)
             throws java.rmi.RemoteException {
                   tempArray = nameofString.toCharArray();
                   char c =  char[0];
                   int c1 = (int) c;
                   c2 = c1+b;
                   return nameofString;
         public String decrypt(String nameofString, int b)
              throws java.rmi.RemoteException {
                   tempArray = nameofString.toCharArray();
                   char d = char[0];
                   int d1 = (int) d;
                   d2 = d2-b;
                   return nameofString;
    }I also have a code called chiper.java which defines the two methods encrypt and decrypt.
    For the impl file i need to make it use the Caesar Cipher method where there is an integer and this integer is used to encrytp a word so if the integer is equal to 1 each of the letters in the word are incremented by 1 so if the word "HELLO" was inputted the output would be "IFMMP" if u get what i mean but i am finding it difficult to put into code.
    Could someone give me a few clues please.
    Thanx
    MARK

    mate, i wasn't saying why are you messing with RMI, what I mean was why are you trying to do it all at once. Try to break down the problem. If all you want to do is to increment the character by one then the simplest way to do it is to set up an array of all the letters of the alphabet. Iterate over the string getting each character. Look it up in the array, and then get the next one, and add that to an output StringBuffer. When you have reached the end of the input string, toString() the StringBuffer, and you are done.
    Fundamentally, programming is all about breaking problems up. If you try and look at everything at once you will either go mad, or not be able to cope.
    HTH

  • I have an iPhone 5 and I can send text messages but have been getting complaints when people have said they text me but I don't text back, I don't seem to recieve all my text messages ? Who should I phone to ask for help or could someone help me please?

    Please will someone help me decide what I should do ? Should I phone my provider or go in to the shop?

    http://support.apple.com/kb/ts2755
    if the above link doesn't work, then contact your phone carrier as SMS is a carrier feature.

  • HT201303 I need to change my security question because I do not know the answer to the car question can someone help me please.

    the security question about which was your favorite car and least fav I cannot remmeber my answer how do i go about changing this or getting a new set up question ?

    Alternatives for Help Resetting Security Questions and Rescue Mail
         1. Apple ID- All about Apple ID security questions.
         2. Rescue email address and how to reset Apple ID security questions
         3. Apple ID- Contacting Apple for help with Apple ID account security.
         4. Fill out and submit this form. Select the topic, Account Security.
         5.  Call Apple Customer Service: Contacting Apple for support in your
              country and ask to speak to Account Security.
    How to Manage your Apple ID: Manage My Apple ID

  • HT202159 Hi there purchased the 10.8.2 update can't download . I'm getting interrupted all the time could someone help me please cheers George

    Hi there
    Purchased the 10.8.2 on the 18/02 ,after 4 trys I get interrupted and have to start all over again the fact that I am on prepaid and have used 8 GB and the connection is slow any suggestion anyone
    Cheers
    George

    Hello ChadMelton,
    I have a hard time passing up offers for free products, so I understand how such an offer could influence your decision to buy. I'm wholly disappointed to read, though, that your rebate experience didn't go smoothly and that the manufacturer seems to have been less than cooperative. I would be frustrated too under such circumstances!
    I was unable to locate your purchase using the information you provided when you signed up for Best Buy Unboxed. I would like to look into this situation on your behalf, but will need more information to begin. If you will please send me a private message that includes your full name, telephone number, order number and/or the Customer Service PIN from your purchase receipt, I'll get started.
    I'm very grateful that you wrote to us with your concerns.
    Sincerely,

  • Could someone help me please because I cannot change my region/country neither on itunes nor in my ipod touch

    I bought my ipod touch when i was on EEUU and i registered being there, But now i moved to Peru and I want to change my billing information and everytime I do it  IT DOESNT CHANGE... Im desesperate because I cant download anything... Please Help me!

    Hi...
    Your credit or debit card credentials (billing) must be associated with the same country where you reside.
    "Although you can browse the iTunes Store in any country without being signed in, you can only purchase content from the iTunes Store for your own country. This is enforced via the billing address associated with your credit card or other payment method that you use with the iTunes Store, rather than your actual geographic location."
    From here >  The Complete Guide to Using the iTunes Store | iLounge Article

  • ITunes wn't show some of the movies I have purhased, how can I make it so I can see that I have purchased them, and so that i can watch them again? Could someone help me please?

    Hello. I purchased movies on the first laptop that i had, but then it stopped working so i bought a new one. not being very good with technology and most likely screwing up somethings on my new laptop with itunes, it wont show that i had purchased any movies at all. I have an ipod touch and one of the movies got downloaded on it, so when i plugged it onto my new laptop it showed that i had it, but the other ones that are not on my ipod touch are also not on my new laptop.
    sorry if this confused you, i just really need help with it because it is about fourty dollars worth of movies. thanks!

    The ipod is not a backup device.  You should have everything on your comptuer backed up to an external source ( cd, dvd, flash drive, external drive, etc).
    Some movies are redownloadable, some are not.  The movie studios decide this.
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • My iPhone 4s says that I'm connected to wifi and I can use it, but only for some apps could someone help me please

    I Need help getting my wifi to work

    I have seen numerous discussions of this on various forums with various brands of phones and various cellular providers. A common opinion is that some types of data usage are summarized and billed during the night -- i.e., the billing time does not reflect the actual time when the data is used. Following is one discussion on the AT&T forum that mentions the issue on a Windows phone and a Samsung Note 3: https://forums.att.com/t5/Windows-Phone/Data-usage-at-night/td-p/3765845

  • Quick question, could someone help

    I'd like to know how to remove the last entry of a String type array, been havin' trouble with it, sorry for the dumb question.

    Depending on what you're tring to achieve,
    myArray[myArray.length - 1] = null;or
    String[] newArray = new String[myArray.length - 1];
    System.arrayCopy(myArray, 0, newArray, 0, newArray.length);
    myArray = newArray;

  • I have a Mac OS X Snow Leopard.  For some unknown reason the Library application in Finder disappeared and I was using it only two days ago.  Please could someone help?  Thanks.

    I have a Mac OS X Snow Leopard.  For some unknown reason the Library application in Finder disappeared and I was using it only two days ago.  Please could someone help?  Thanks.

    Hi cb-anc!  Thank you for replying to my question.  The Library application has disappeared,not the library folder.  I went into the application a couple of days ago to trash some plist files and now the application has disappeared. I haven't upgraded to Lion but am still on now Leopard.

  • I have  Mac os x 106. When I try to send an attachment with email it won't send.  Please could someone help? Thank you.

    I have a Mac OS X 10.6 When I try to send an attachment with email it won't send - keeps saying 'fail'.  Please could someone help? Thank you.

    Hi lllaass! I replied to your post with the information you required but haven't heard from you since. If you don't, or can't help any further please would you let me know. Thanks.

Maybe you are looking for

  • Problem with iPod Photo

    A friend of mine have an iPod Photo, but has recently experienced problems. The problem is that iTunes begin to uppdate songs, that are allready on the iPod. So he ends double up with some songs. Another problem is that the iTunes does`nt reconize th

  • [SOLVED] Broken Gnome

    Hello, Everything was going well and I installed a few packages etc. After rebooting when I run gnome-session I get the following errors: Gtk-WARNING **: locale not supported by C library using the fallback 'C' locale Gtk-WARNING **: cannot open disp

  • How can I get adobe on my iPad?

    Does anyone know.

  • VARIABLE IN MDX FORMULA

    Hello, I have a package which only rund a logic, this package enables to select an entity on which the logic will run so in my package assign parameters component , i have my prompt PROMPT(SELECTINPUT,%MY_ENTITY%,"Enter the entity",,"%ENTITY_DIM%") a

  • Procedure  for  Accessing  WebService in ejb By using NetWeaver,

    hai, This is Guru. please tell me the procedure for accessing a webservice in ejb . my mean is. i have one Session Beab,And there is one webservice. How can i  call and using  that webservice in netweaverdeveloperstudio tool.please send me code,if u