Can anyone assist me with this problem

hey guys thanks for reading this hey,
The assignment suggest the use of maps but i am not sure how i can use maps to help me as i am relitivley new to the collections heirahcy. I have attached the code i have so far. i am desperatly in need of help. an explanation of what the program will print is below.
input needs to be grabbed from file
Brazil 1 France 2
France 1 Germany 2
Germany 0 Japan 3
Germany 2 Brazil 0
France 4 Japan 4
Then the corresponding summary written to standard output should be:
Team W D L F A P
Germany 2 0 1 4 4 6
Japan 1 1 0 7 4 4
France 1 1 1 7 7 4
Brazil 0 0 2 1 4 0
For each team, the output contains the number of games won (W), the number of games drawn (D), the number of games lost (L), the total number of goals scored (F, "goals for"), the total number of goals scored by the teams' opponents (A, "goals against"), and the total number of points (P). A team scores 3 points for a win, 1 point for a draw, and 0 points for a loss.
here is the code that i have so far assembled.
import java.io.*;
import java.util.*;
class Soccer
     //declare varibles
     StringTokenizer st;                    // StringTokenizer for separating values
     BufferedReader in;                    // BufferedReader for reading standard input
     BufferedReader infile;               // reads data from input file
     String input;                        // holds input data temporarily
     int count;                              // String input to hold line details
     Map teams = new HashMap();          //creates a new hash map for holding data
     public static final Integer ONE = new Integer(1);     //for distinct wrods count
     String[] temp;
     public static void main (String [] args)
          Soccer app = new Soccer();
               app.input(args);
     }//end main
     public void input(String [] args)
          try{
               //standard output to screen
               in = new BufferedReader(new InputStreamReader(System.in));
               //input from filend class
               infile = new BufferedReader(new FileReader(args[0]));
               input = infile.readLine();
               st = new StringTokenizer(input);
               count = st.countTokens();
               temp = new String[count];
               for(int i = 0; i < count; i++)
                     temp[i] = st.nextToken();
               }//end for
               //start if map code
               Map map = new HashMap(); // Maps words to no. of occs.
               for (int i = 0; i < count; i++) {
                    // Get number of occurrences of next word
                    Integer value = (Integer) map.get(temp);
                    // Increment number of occurrences of word
                    if (value == null) {
                         map.put(temp[i], ONE);
                    } else {
                         int val = value.intValue();
                         map.put(temp[i], new Integer(val+1));
               }//end for
               // Print values of map, one per line
               Iterator it = map.keySet().iterator();
               while (it.hasNext() ) {
               Object key = it.next();
               System.out.println(key + " = " + map.get(key));
               } catch (IOException e){
                    System.out.println("ERROR: " + e.getMessage());
               //call the print method
               print();
     }//end input
     public void print()
          System.out.println("Team     W D L A P ");
     }//end print
}//end class

can anyone assist me with this problem
Write a better subject, go see you lecturer.

Similar Messages

  • Spry complications in Firefox....can anyone assist me with this problem?

    Greetings!
    I've had quite a problem with Firefox and Spry, as you can tell by visiting the site I'm designing (for an American Studies Department): http://amerstudies.rutgers.edu
    None of the Spry elements on the page work...at all... when I use Firefox. On both IE and Safari, the page looks fine. Can anyone help? I've been trying to resolve this issue for some time now...
    Your assistance in this matter is very much appreciated.
    Many thanks.
    -J

    Hi John,
    The culprit code is
    <div class="topbar">   
    <div class="searchbar">
      <form name=gs method=GET action=http://www.google.com/u/rutgerz>
    <input type=hidden name=hl value="en">
    <input type=hidden name=lr value="">
    <input type='hidden' name='as_dt' value='i'/>
    <input type='hidden' name='as_sitesearch'value='www.amerstudies.rutgers.edu'/>
    <input type=hidden name=ie value="ISO-8859-1">
    <input type=text name=q size=31 maxlength=2048 value="">
    <font size=-1> <input type=submit name="btnG" value="Search">
      </form>
    </div></div>
    The code in red does not have an end tag and is therefore not XHTML compliant
    The code in orange is nothing at all!
    Replace the above code with:
    <div class="topbar">   
      <div class="searchbar">
        <form name=gs method=GET action=http://www.google.com/u/rutgerz>
          <input type=hidden name=hl value="en" />
          <input type=hidden name=lr value="" />
          <input type='hidden' name='as_dt' value='i' />
          <input type='hidden' name='as_sitesearch'value='www.amerstudies.rutgers.edu' />
          <input type=hidden name=ie value="ISO-8859-1" />
          <input type=text name=q size=31 maxlength=2048 value="" />
          <input type=submit name="btnG" value="Search" />
        </form>
      </div>
    </div>
    and your Spry will work.
    Ben

  • I have a licensed copy of Adobe Acrobat X Pro for Windows.  I recently switched over to MAC OS and would like to move my Adobe X Pro over but the CD will not work for Mac OS?  Can anyone assist me with this conversion?  Best,  James.

    I have a licensed copy of Adobe Acrobat X Pro for Windows.  I recently switched over to MAC OS and would like to move my Adobe X Pro over but the CD will not work for Mac OS?  Can anyone assist me with this conversion?
    Best,
    James.

    you cannot use your pc license to install on a mac.  you would need a separate license (and serial number) for that.
    adobe allows platform swaps, but only with the latest (xi) version, Order product | Platform, language swap
    your option to use acrobat on a mac are to upgrade to acrobat pro xi and change platforms, use a windows emulator (parallels/boot camp etc) on your mac or swap with a third party.

  • I'm having trouble with the volume of my i phone 4s when using headphones, the sound will only appear when the volume is at its highest, any lower and all I hear is static. Can anyone help me with this problem? Much appreciated.

    Hi, I'm using a white iPhone 4s with 16gb memory and having some problems. Whenever I use earphones the sound will be heated when the volume is at the highest if I turn it down any lower all I hear is static. Can anyone help me with this problem as I would appreciate it much.

    Reset the device:
    Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears.
    If that doesn't help, tap Settings > General > Reset > Reset All Settings
    No data is lost due to a reset.

  • My ipod nano 7th generation won't play anything and when i click "radio" it says to plug in headphones when they're in. Can anyone help me with this problem?

    my ipod nano 7th generation won't play anything and when i click "radio" it says to plug in headphones when they're in. Can anyone help me with this problem?

    Get a flashlight and make sure there is no obstruction/dirt/debris in the Nano headphone jack. Be sure you plug the headphones all the way in, the plastic on the headset jack should be flush with the body of the Nano.

  • TS2634 the flashing light next too the camera is stays on,can anyone help me with this problem.thanks

    the flashing light next too the camera is stays on,can anyone help me with this problem.thanks

    Basics from the manual are restart, reset, restore.  Have you tried these?
    Have you read the manual?

  • I just loaded Lion oxs 10.71 and now my Logic 9 software wont show up it says its not compatible also i cant find my macintosh harddrive icon that is usually shown on dektop and device browser column can anyone help me with this problem

    I just loaded Lion oxs 10.71 on my I-mac computer, and now my Logic 9 software wont show up it says its not compatible also i cant find my macintosh harddrive icon that is usually shown on dektop and device browser column can anyone help me with this problem.

    Mike,
    I had a similar issue with Photoshop when I upgraded to both Snow Leopard and Lion.  it turned out to be Rosetta is no longer present in the newer OS.  Once I upgraded to Lion, Appleworks stopped working after all these years.

  • My iPhone won't stay sync'd to iTunes, It syncs but then disconnects, then reconnects. Can anyone help me with this problem??

    Everytime I connect my Iphone to my computer, it syncs, then soon after disconnects, then reconnects, and so on....Does anyone know why it's doing this? It makes it hard to back things up and charge it. I checked and my iTunes and iPhone software are updated and my computer is only 6 months old....help please!

    Reasons for Drive Failure
    Hard drives are mechanical devices with moving parts, so they are subject to expected wear and tear, and can potentially fail mechanically at any given time. But most manufacturers will label their product with an expected average lifespan (usually provided in total expected number of functioning hours). But if a part is faulty or there are some manufacturing defects, a drive's lifespan can be over in as little as a day. Other factors are primarily external in nature. Power surges can cause drive failure, as can fire or water damage, along with a number of computer viruses. Exposure to high levels of magnetism can disrupt the normal functions of a drive, along with sharp impacts. If dust gets into a drive, it can become the catalyst for an eventual failure.
    You could try to boot with this. It will test your HD!
    I would say your HD is toast!http://www.seagate.com/support/internal-hard-drives/consumer-electronics/ld25-series/seatools-dos-ma...
    Read more: http://www.ehow.com/about_5087073_causes-hard-drive-fail.html#ixzz2aOMvlQ8w
    I Love my Satellite L775D-S7222 Laptop. Some days you're the windshield, Some days you're the bug. The Computer world is crazy. If you have answers to computer problems, pass them forward.

  • Can anyone help me with this problem?

    Okay, here's the deal. My girlfriend's Toshiba laptop fell off her nightstand, and took a 2.5 foot fall to her hard wooden floor. It landed on the right side, which as you all probably know has both the hard drive and DVD drive. Setting aside the fact that it happened, let me explain the dilemma.
    It powers up, but won't boot windows 7. I immedately think the hard drive is f*cked, but I'm not sure. It shows the Toshiba screen for a couple seconds, where you can enter BIOS. After that, it goes to a black screen with a blinking underscore at the top left hand corner. It then stays that way indefinitely, with the underscore eventually going away to where it's nothing but a black screen (but lit up, not black like when it's turned off).
    I am convinced it won't pass POST. However, I'm not sure if it's the hard drive or the DVD drive. Here's why: 
    When I enter BIOS, I tried switching the primary drive check in the Boot tab, to where it checks the DVD drive first. Then when I restarted it, it would give me a message saying "drive failed to boot (dvd drive name here, can't remember off the top of my head)'". Does this mean the DVD drive is now defective, or does it fail to boot because of a lack of connection from the hard drive, which might be defective? If I keep the hard drive set as the primary drive being checked during bootup, I don't get that message.  When I see her again, I will see if I can swap out her hard drive with the one from my laptop, assuming they have the same sockets. 
    I'm wondering, can a defective DVD drive keep a computer from loading the OS, or is it just the hard drive? I'm an amateur when it comes to computers, so these are the questions I don't know the answer to. One other thing to mention, is I disabled the DVD drive in BIOS, and it still wouldn't load windows 7. That's why I'm leaning towards a defective hard drive. 
    But, I'm not certain. I'm at a loss as to which it could be, or if it's even one of the two drives. Any help or other recommended procedures to do an at-home diagnostics check would be greatly appreciated. The model is a Satellite a665. 
    Thanks in advance, I really do appreciate any input!

    Reasons for Drive Failure
    Hard drives are mechanical devices with moving parts, so they are subject to expected wear and tear, and can potentially fail mechanically at any given time. But most manufacturers will label their product with an expected average lifespan (usually provided in total expected number of functioning hours). But if a part is faulty or there are some manufacturing defects, a drive's lifespan can be over in as little as a day. Other factors are primarily external in nature. Power surges can cause drive failure, as can fire or water damage, along with a number of computer viruses. Exposure to high levels of magnetism can disrupt the normal functions of a drive, along with sharp impacts. If dust gets into a drive, it can become the catalyst for an eventual failure.
    You could try to boot with this. It will test your HD!
    I would say your HD is toast!http://www.seagate.com/support/internal-hard-drives/consumer-electronics/ld25-series/seatools-dos-ma...
    Read more: http://www.ehow.com/about_5087073_causes-hard-drive-fail.html#ixzz2aOMvlQ8w
    I Love my Satellite L775D-S7222 Laptop. Some days you're the windshield, Some days you're the bug. The Computer world is crazy. If you have answers to computer problems, pass them forward.

  • My art work isn't matching the song on my ipod 5, can anyone help me with this problem

    I have the Ipod touch 5 and my art work isn't matching the song that's being played. For example if Im listening to Jay-Z, Fantasia's art work will appear. Has anyone else experienced this problem? If so how did you resolve it?

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Unsync/delete  all music and resync
    To delete all music go to Settings>General>Usage>Storage>Music>Tap edit in upper right and then tap the minus sign by All Music
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                                
    iOS: How to back up                                                                
    - Restore to factory settings/new iOS device.             

  • 29 Hits but no help...Can anyone assist me with this? Surely someone knows?

    Anyone that can help it is truly appreciated. I just can't figure out how the ipod updates. I have 3 folders with different music...oldies, favorites, showtunes. I keep an exact copy of the playlist in I-Tunes. Let's just say I have 50 songs on my ipod in "Showtunes." I added 25 songs in I-tunes and added those 25 songs to my playlist. I then update my ipod by pulling the playlist from I-tunes onto the i-pod playlist. It says it is updating the 25 songs only. When I view the ipod thru itunes it has the new 25 songs and duplicates for all the others. When I unplug the ipod and view the songs there are a few duplilcates, but not all the same ones and not as many. I go thru and remove the extras on my ipod. Now there is basically just one song of each, but there are like 5 songs at the top not in any order and then it starts alphabatizing the rest. Could someone please tell me what the correct way to add music to my ipod is? Can I just pull over the new songs onto the ipod and will the old music stay just as it is? I was under the impression that i had to "Sync" it each time...whatever that is. Why can't this be simple and you just add or remove your songs you want. Please help, I am so frustrated. Thanks so much!

    Hi Gary,
    Very confusing post, but I think I know what you are looking for. There are two ways to update your music on your ipod: manually and automatically. Automatically is probably the easiest and the best for your situation.
    First, plug in your ipod to your computer and itunes should open up. Click on your ipod in itunes under devices. There should be 5 tabs at the top of the page (Summary, Music, Podcasts, Photos, Contacts).
    On the Summary tab make sure that Manually manage music checkbox is NOT selected.
    Click on Music tab ensure that the Sync music checkbox is checked and the All songs and playlists radiobutton is also selected.
    Click on Apply at the bottom right of the screen.
    From the File Menu select Sync "(name of your ipod)" and let the system sync it up.
    When you make changes to the playlists, just make them in iTunes and when you are ready to transfer to your iPod, just plug in your iPod and it will sync automatically. If you are already plugged in and you make changes to iTunes, then go to File>Sync"(name of your iPod)" and sync from there.
    Don't worry about making changes to your iPod manually. Do all changes in iTunes and let the computer sync them up.
    Good Luck
    cyrus
    G4 emac, G4 ibook, 30gb iPod photo Mac OS X (10.4.2)
    G4 emac, G4 ibook, 30gb iPod photo   Mac OS X (10.4.2)  

  • Can anyone help me with this problem?? Internet and Picture mail stopped working?

    I just got my blackberry curve (8330) about a month ago, and about two weeks ago, my internet and picture mail just stopped working. I get the message with the picture in it, but it says I cannot retrieve it. And then when I try to send a picture message, it always fails. As for my internet, it will take  f o r e v e r  to load, then it will say there is a connection error. And I went to manage connections and it says that I'm not connected to the blackberry internet or enterprise server. I've tried "provisioning it" because that is what the person I talked to on the sprint website said to do, but it loads for a few minutes and then says "Provisioning cancelled..."
    Has this happened to anyone else?? How do you fix it?

    Hi and Welcome to the Forums!
    I suggest the following steps:
    1) Register HRT
    Homescreen > Options > Advanced Options > Host Routing Table > BBKey (it does not matter which line is current) > Register Now
    2) Resend Service Books
    KB02830 Send the service books for the BlackBerry Internet Service
    3) Batt Pull Reboot
    Anytime random strange behavior or sluggishness creeps in, the first thing to do is a battery pop reboot. With power ON, remove the back cover and pull out the battery. Wait about a minute then replace the battery and cover. Power up and wait patiently through the long reboot -- ~5 minutes. See if things have returned to good operation. Like all computing devices, BB's suffer from memory leaks and such...with a hard reboot being the best cure.
    Hopefully that will get things going again for you!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Can anyone please help with this problem... (home page access)

    read other articles and here is some data for your to go over.
    =====================================================================
    SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 28 09:37:18 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    SQL> connect / as sysdba
    ERROR:
    ORA-12631: Username retrieval failed
    SQL>
    ==================
    C:\>lsnrctl status
    LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 28-NOV-2006 08:19
    :39
    Copyright (c) 1991, 2005, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Produ
    ction
    Start Date 27-NOV-2006 16:14:11
    Uptime 0 days 16 hr. 5 min. 27 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Default Service XE
    Listener Parameter File C:\oraclexe\app\oracle\product\10.2.0\server\network\a
    dmin\listener.ora
    Listener Log File C:\oraclexe\app\oracle\product\10.2.0\server\network\l
    og\listener.log
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC_FOR_XEipc)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=jantar)(PORT=15
    21)))
    Services Summary...
    Service "CLRExtProc" has 1 instance(s).
    Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    The command completed successfully
    Also netstat does not show anything running on port 8080.
    ============================================
    C:\Documents and Settings\N0139838>net start
    These Windows 2000 services are started:
    Alerter
    COM+ Event System
    Computer Browser
    DHCP Client
    Diskeeper
    Distributed Link Tracking Client
    Distributed Transaction Coordinator
    DNS Client
    EPAService
    Event Log
    Infrared Monitor
    Logical Disk Manager
    Machine Debug Manager
    Messenger
    Net Logon
    Network Connections
    OracleServiceXE
    OracleXETNSListener
    Plug and Play
    Print Spooler
    Protected Storage
    Remote Access Connection Manager
    Remote Procedure Call (RPC)
    Remote Registry Service
    Removable Storage
    RunAs Service
    SafeBoot Configuration Manager
    SavRoam
    Security Accounts Manager
    Server
    SMS Agent Host
    SMS Remote Control Agent
    SU Service
    Symantec AntiVirus
    Symantec AntiVirus Definition Watcher
    Symantec Event Manager
    Symantec Settings Manager
    System Event Notification
    Task Scheduler
    TCP/IP NetBIOS Helper Service
    Telephony
    Windows Management Instrumentation
    Windows Management Instrumentation Driver Extensions
    Windows Time
    WMDM PMSP Service
    Workstation
    The command completed successfully.
    ===========================================
    Ping 127.0.0.1 or localhost is successfull.
    ===============================================
    C:\Documents and Settings\N0139838>netstat -a
    Nothing is running on port 8080.

    Hi,
    Have you install Oracle XE as an Administrator or member of Administrators group?
    Have you ever started the Oracle home page?
    Do you have any other Oracle installation?
    What kind of OS do you use? I can see Windows 2000.
    Those two services OracleServiceXE and OracleXETNSListener are enough to run XE.
    You could check by the Task Manager:
    - OracleServiceXE should be about 50K
    - OracleXETNSListener – 6K
    Turn those services to Manual. Restart the computer and Start Oracle database.
    You can check the LISTENER.ORA. Host should be your host name. Same into TNSNAMES.ORA. If the HOST = YourComputerName there are OK.
    Then you should check for any firewall. For instance, Zone Alarm could prevent to access your database.
    I hope that would help.
    Konstantin

  • I didn't receive iWork apps for free after updating iOS 7 in my iPhone 4s. Can anyone help me with this problem?

    Is there anyone have the same problem?

    Actually, if I read the release announcement correctly, it is available on "new" purchases." So even if you had a 5 from before the announcement, I'm not sure you would qualify.

  • HT1904 I have money on my itune acct. but it will not let me make a purchase. Can anyone help me with this problem?

    I have money on my itunes account but it will not let me make a purchase.

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    * Edit > Preferences > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    * Edit > Preferences > Privacy > Cookies: "Show Cookies"

Maybe you are looking for

  • Can no longer find my Time Capsule.

    My Time capsule, that I bought back of last year in April has been working flawlessly, until a couple of days ago. Now, it con no longer be found on the network. It is connected via an Ethernet cable and is in another room (it's connected to my iMac,

  • Monitoring WCI 10.3.0 & UCM 10.1.3.5 using OEM 11g R1

    As part of the Service Monitoring for our OFM-OUCM environment, we have implemented OEM 11g R1. Our Dev/Test/UAT/Prod environment is comprised of SOA 10.1.3.5, WCI 10.3, UCM 10.1.3.5, multiple DB instances 10.2.0.3/10.2.0.4, IDM 10.1.4.0.1. We are ab

  • Ole2 object can not kill excel.exe process

    Hi every body I have a code that I have to generate lots of excel file from ole2 object. I have a loop and I generate excel file in it. my problem is that after each step that one excel file created and quit from that, excel.exe process will remain i

  • Unicode Conversion Program

    Hi All, For a program there are using the SET/GET PARAMETER statements and they are capturing the respective fields. In the Unicode conversion it is saying that, at SET/GET PARAMETER statements it is saying that (must be a character-type field (data

  • Help in automatic clearing

    Hiii Experts, i have a General Ledger which is shown TICK(i.e- Posted) instead of open.. and posting a screenshot of FBL3N of General Ledger. I have checked open line management is not maintained for the GL in fs00.. but the client want to run that G