Can you tell me what this code does?

Can you tell me what this code does?
import java.io.*;
class Assignment1
public static String[][] tdi = {     {"Paris", "418", "Rome", "55"},
                         {"Liverpool", "121", "Copenhagen", "35"},
                         {"Liverpool", "418", "Paris", "50"},
                         {"Liverpool", "553", "Frankfurt", "55"},
                         {"Frankfurt", "553", "Budapest", "50"},
                         {"Amsterdam", "121", "Madrid", "65"},
                         {"Amsterdam", "418", "Paris", "35"},
                         {"Madrid", "121", "Stockholm", "90"},
                         {"Budapest", "553", "Warsaw", "30"},
                         {"Copenhagen", "121", "Amsterdam", "35"},
                         {"Rome", "418", "Amsterdam", "60"},
//--Start Method--
public static void main( String args[] ) throws IOException
System.out.println("Welcome to NoWings Airline.");
InputStreamReader input = new InputStreamReader(System.in);
BufferedReader keyboardInput = new BufferedReader(input);
System.out.println("Please enter the airport you wish to depart from:");
String[] info = TDIDLL.searchDest( keyboardInput.readLine() );
if (info == null)
System.out.println("Sorry, no plane to this destination");
else
System.out.println(info[0]+" departing at platform "+info[1]); }}
public static String[] searchDest( String dest )
String[] result = null;
for(int i = 0; i < tdi.length; i++)
     if (tdi[1].equals(dest)) {
     result = new String[2];
     result[0] = tdi[i][0];
     result[1] = tdi[i][2];
     return result;
return result; }
// Info Method //
// Fly Method //
// Exit Method //
Thanks. Also, can you tell me where I have gone wrong in the code.
Much appreciated.

Can you tell me what this code does?Why don't you run it and find out for yourself?

Similar Messages

  • I keep getting this error in Dreamweaver when I am trying to upload my website?  Can you tell me what I am doing wrong?  here is the error message: /html - error occurred - Unable to create remote folder /html.  Access denied.  The file may not exist, or

    I keep getting this error in Dreamweaver when I am trying to upload my website?  Can you tell me what I am doing wrong?  here is the error message: /html - error occurred - Unable to create remote folder /html.  Access denied.  The file may not exist, or there could be a permission problem.   Make sure you have proper authorization on the server and the server is properly configured.  File activity incomplete. 1 file(s) or folder(s) were not completed.  Files with errors: 1 /html

    Nobody can tell you anything without knowing exact site and server specs, but I would suspect that naming the folder "html" wasn't the brightest of ideas, since that's usually a default (invisible) folder name existing somewhere on the server and the user not having privileges to overwrite it.
    Mylenium

  • Can you tell me what Error code 2721 is?

    Can you tell me what Error code 2721 is? And how do I work around this.

    Can you tell me what Error code 2721 is? And how do I work around this.

  • On my new iPad under the space category it shows I have 5.5gb occupied by 'Other" data - Can you tell me what this is exactly and how can I reduce it Thank-you

    On my new iPad under the space category it shows I have 5.5gb occupied by 'Other" data - Can you tell me what this is exactly and how can I reduce it
    Thank-you

    How Do I Get Rid Of The “Other” Data Stored On My iPad Or iPhone?
    http://tinyurl.com/85w6xwn
    With an iOS device, the “Other” space in iTunes is used to store things like documents, settings, caches, and a few other important items. If you sync lots of documents to apps like GoodReader, DropCopy, or anything else that reads external files, your storage use can skyrocket. With iOS 5, you can see exactly which applications are taking up the most space. Just head to Settings > General > Usage, and tap the button labeled Show All Apps. The storage section will show you the app and how much storage space it is taking up. Tap on the app name to get a description of the additional storage space being used by the app’s documents and data. You can remove the storage-hogging application and all of its data directly from this screen, or manually remove the data by opening the app. Some applications, especially those designed by Apple, will allow you to remove stored data by swiping from left to right on the item to reveal a Delete button.
     Cheers, Tom

  • "CAHeadless error Sequence.cpp-2233" after computer starts up.  Can you tell me what this is or how to fix it?  Thanks!

    Since installing Adobe Premier Elemnts 12 I get a message that says "CAHeadless error Sequence.cpp-2233" after computer starts up.  Can you tell me what this is or how to fix it?  Thanks!

    If you are using Firefox 3.6.6 version, open Tools > Options >> Advanced - Network
    The under Connections hit the Settings button - then select '''No proxy''' at the top of those settings. Restart Firefox and you should be all set.
    ''(3.6.6 added a new setting there - Use system proxy settings and sets that as the Default setting)''

  • Everytime i try to download illustrator an error occurs U44M1I210. Can you tell me what this is? I even tried uninstalling an downloading the cloud again, but the same error occurs.

    Everytime i try to download illustrator an error occurs U44M1I210. Can you tell me what this is? I even tried uninstalling an downloading the cloud again, but the same error occurs.Everytime i try to download illustrator an error occurs U44M1I210. Can you tell me what this is? I even tried uninstalling an downloading the cloud again, but the same error occurs.

    U44M1I210 - Creative Cloud Help / Error U44M1I210 | Install updates :
    http://helpx.adobe.com/creative-suite/kb/error-u44m1i210-installing-updates-ccm.html

  • On my list of calls made/received some of them have an icon which is a phone handset and something else.  Can you tell me what this is and where to I D icons?

    On my list of incoming/outgoing phone calls some of them have an icon beside the name which is a telephone handset and something else I don't recognize.  Can anyone tell me what it means and where to find a list of icon explanations?  Thanks. 

    You're probably talking about the handset with an arrow pointing up and to the right. That indicates an outgoing call.

  • I have created a word document but am sending to recipients in pdf format. They told me they cannot open it. Can you tell me what I am doing wrong? Thank you.

    I have created a document in word and sent it to my recipients in pdf format so they would receive it just as I had formatted it. I used an unusual font. But my recipients tell me they cannot open it. Can you help me understand what I am doing wrong. Thank you.

    How are you generating the PDF file? Are you zipping (compressing) the file before sending it? Is Mail configured to send Windows-friendly files?
    If you are using Word to generate the PDF file, then try instead to use the Word Print dialog. Click on the PDF dropdown menu in the lower left corner and select the option to Save as PDF.... You can save the output to the Desktop or any location your prefer. Use that document to send to others via email, but remember to compress the file first.

  • Repeating Message in Console.  Can you tell me what this means?

    Hello. I am receiving this repeating message in console every 10 seconds and I think it's the result of a application that I once had that I removed many months ago and apparently I'm being pinged or something. How can I get rid of this?
    I had at one time a wireless Nikon digital camera wireless software installed that I've removed but apparently something somewhere in my mac is trying to communicate with Nikon...in Japan! Does this look right? Any help would be greatly appreciated....
    1/22/08 6:49:37 PM com.apple.launchd[1] (jp.co.nikon.NikonPtpEnum[291]) posix_spawnp("/Applications/Nikon Software/Wireless Camera Setup Utility/NikonPtpEnum", ...): No such file or directory
    1/22/08 6:49:37 PM com.apple.launchd[1] (jp.co.nikon.NikonPtpEnum[291]) Exited with exit code: 1
    1/22/08 6:49:37 PM com.apple.launchd[1] (jp.co.nikon.NikonPtpEnum) Throttling respawn: Will start in 10 seconds
    1/22/08 6:49:47 PM com.apple.launchd[1] (jp.co.nikon.NikonPtpEnum[292]) posix_spawnp("/Applications/Nikon Software/Wireless Camera Setup Utility/NikonPtpEnum", ...): No such file or directory
    1/22/08 6:49:47 PM com.apple.launchd[1] (jp.co.nikon.NikonPtpEnum[292]) Exited with exit code: 1
    1/22/08 6:49:47 PM com.apple.launchd[1] (jp.co.nikon.NikonPtpEnum) Throttling respawn: Will start in 10 seconds
    1/22/08 6:49:57 PM com.apple.launchd[1] (jp.co.nikon.NikonPtpEnum[294]) posix_spawnp("/Applications/Nikon Software/Wireless Camera Setup Utility/NikonPtpEnum", ...): No such file or directory
    1/22/08 6:49:57 PM com.apple.launchd[1] (jp.co.nikon.NikonPtpEnum[294]) Exited with exit code: 1
    1/22/08 6:49:57 PM com.apple.launchd[1] (jp.co.nikon.NikonPtpEnum) Throttling respawn: Will start in 10 seconds
    1/22/08 6:50:07 PM com.apple.launchd[1] (jp.co.nikon.NikonPtpEnum[296]) posix_spawnp("/Applications/Nikon Software/Wireless Camera Setup Utility/NikonPtpEnum", ...): No such file or directory
    1/22/08 6:50:07 PM com.apple.launchd[1] (jp.co.nikon.NikonPtpEnum[296]) Exited with exit code: 1

    There is still a piece of the software that is trying to startup, but cannot. launchd is the daemon in charge of starting things and trying to make sure they keep running. It is not trying to contact Japan--certain files are named in reverse domain name format.
    Try looking in a StartupItems folder or the LaunchDaemons folder in you user Library or the main Library folders.

  • PLEASE CAN YOU TELL ME WHAT THIS ERROR MEANS?

    The script attached to my button reads:-
    //This script takes the user to Scene 1 when opendoor is
    released
    on(Release) = function (){
    gotoAndStop("Scene 1", 1);
    The errors in the Output Panel are:-
    **Error** Scene=Scene 2, layer=door, frame=1:Line 2: '{'
    expected
    on(Release) = function () {
    **Error** Scene=Scene 2, layer=door, frame=1:Line 4:
    Statement must appear within on handler
    I will be eternally grateful to anyone who can sort me out!!

    SLMHILL wrote:
    > The script attached to my button reads:-
    >
    > //This script takes the user to Scene 1 when opendoor is
    released
    > on(Release) = function (){
    > gotoAndStop("Scene 1", 1);
    > };
    >
    > The errors in the Output Panel are:-
    >
    > **Error** Scene=Scene 2, layer=door, frame=1:Line 2: '{'
    expected
    > on(Release) = function () {
    >
    > **Error** Scene=Scene 2, layer=door, frame=1:Line 4:
    Statement must appear
    > within on handler
    > };
    >
    > I will be eternally grateful to anyone who can sort me
    out!!
    >
    >
    >
    SLMHILL,
    You're mixing two ways of writing event handlers. If you want
    to attach
    the script to your button directly, use this code:
    on(Release) {
    gotoAndStop("Scene 1", 1)
    Or, if you want to place all of the scripting in one place,
    on a frame
    on the main timeline, you would use the code below.
    opendoor.onRelease = function (){
    gotoAndStop("Scene 1", 1);
    To do this, make sure your button on the stage has an
    instance name of
    "opendoor" -- instance name is in the Properties panel.
    Then make a new layer called "actions" and make sure to click
    on it in
    the timeline, then open the Actions panel and write the code.

  • Can anyone tell me what this is doing

    hey this is part of some parser code from an earlier java forum post
    http://forum.java.sun.com/thread.jspa?threadID=506162&messageID=2399163#239 9163
    i modified the code slightly to work with my program which involves its use in an applet and to solve logical equations. However i'm still uncertain as to what certain sections of the code are doing
    i know that this code evaluates the variables within the given equation, begins a for loop that does not exit until i = codeSize which is the length of the given String. However i'm not so certain as to how it achieves this. I'd like to know
    private int eval(int variableX, int variableY, int variableZ)
                    try {
                            int top = 0;
                            for (int i = 0; i < codeSize; i++)
                                    if (code[i] >= 0)
                                            stack[top++] = constants[code];
    else if (code[i] >= POWER)
    int y = stack[--top];
    int x = stack[--top];
    int ans = (int)Double.NaN;
    switch (code[i])
    case PLUS: ans = x | y; break;
    case MINUS: ans = x & y; break;
    case TIMES: ans = x & y; break;
    case DIVIDE: ans = x / y; break;
    // case POWER: ans = Math.pow(x,y); break;
    if (Double.isNaN(ans))
    return ans;
    stack[top++] = ans;
    else if (code[i] == VARIABLEX)
    stack[top++] = variableX;
    else if (code[i] == VARIABLEY)
    stack[top++] = variableY;
    else if(code[i] == VARIABLEZ)
    stack[top++] = variableZ;
    /* else {
    double x = stack[--top];
    double ans = Double.NaN;
    int d;
    d = (int) ans;
    switch (code[i])
    case SIN: ans = Math.sin(x); break;
    case COS: ans = Math.cos(x); break;
    case TAN: ans = Math.tan(x); break;
    case COT: ans = Math.cos(x)/Math.sin(x); break;
    case SEC: ans = 1.0/Math.cos(x); break;
    case CSC: ans = 1.0/Math.sin(x); break;
    case ARCSIN: if (Math.abs(x) <= 1.0) ans = Math.asin(x); break;
    case ARCCOS: if (Math.abs(x) <= 1.0) ans = Math.acos(x); break;
    case ARCTAN: ans = Math.atan(x); break;
    case EXP: ans = Math.exp(x); break;
    case LN: if (x > 0.0) ans = Math.log(x); break;
    case LOG2: if (x > 0.0) ans = Math.log(x)/Math.log(2); break;
    case LOG10: if (x > 0.0) ans = Math.log(x)/Math.log(10); break;
    case ABS: ans = Math.abs(x); break;
    case SQRT: if (x >= 0.0) ans = Math.sqrt(x); break;
    case UNARYMINUS: ans = -x; break;
    if (Double.isNaN(ans))
    return d;
    stack[top++] = d;
    catch (Exception e)
    double b = Double.NaN;
    int i = (int)b;
    return i;
    } double d2;
    if (Double.isInfinite(stack[0]))
    d2 = Double.NaN;
    int i2 = (int) d2;
    return i2;
    }else
    return stack[0];
    any help much appreciated
    cheers
    podger

    Well this is a very basic interpreter. What this piece of code does is:
    1) take an opcode from the code array, and retrieves the description for it from the constants array. This description is stored in the stack array.
    stack[top++] = constants[code];
    2) check what opcode it is
    switch (code)
    3) "execute" the opcode with simple java math operators.
    case PLUS:    ans = x | y;  break;
    case MINUS:   ans = x & y;  break;
    case TIMES:   ans = x & y;  break;
    case DIVIDE:  ans = x / y;  break;4) store the result of the opcode in the stack array, after the description of the opcode retrieved in step 1)
    stack[top++] = ans;There is also some sort of error check in there: initially the result of the opcode is "NaN", (not a number). If the opcode passed to this code is not known, the result is not added to the stack according to this piece of code:
    if (Double.isNaN(ans))
    return ans;

  • I had to dump my drive and when I restored it and I tried to open Dreamweaver, I'm getting this error message 150:30.  Can you tell me what this is

    I need help.  When I restored my hard drive and tried to open dreamweaver it gave me this error message  150:30.  It's telling me that the licensing for this product has stopped working.  Can you explain

    Use the CS Cleaner Tools and Re-install your software.
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
    Nancy O.

  • Since passing to ML, I have a message, in French, which is: La connexion au serveur a échoué. Les URL de type "file" ne sont pas prises en charges.  Can you tell me what this means and how to get rid of it? thank you.

    What does this message mean?
    La connexion au serveur a échoué.  Les URL de type "file" ne sont pas prises en compte.
    thank you.

    Without more information, ie what were you trying to do when you got this message, it is very hard to answer your question. If you were trying to access a webpage it means the server the page is on had a problem. If you were doing something else please post back and someone may have the answer.

  • Can you tell me what this error is?

    I hook up my iphon and it charges but heres what itune says "ITunes could not connect to this IPhone because an unkown error occured (0xE8000065)"
    What error is this? What is wrong?

    Check out this article for some possible solutions:
    http://support.apple.com/kb/TS3221

  • Can you tell me what this means?

    Im getting a horrible like bad color tv problem on the top of my monitor.
    http://i235.photobucket.com/albums/ee55/xjman349er/Picture2.png
    Any advice would be awesome.

    I suspect that's a problem with the graphics memory but;
    Try running Utilities/ColorSynch Utility and 'Repair Profiles'
    Try doing a Parameter RAM reset - hold down apple/option/p/r keys at start up and wait for three chimes before releasing the keys.
    If they don't help, Boot from Install DVD1 holding down 'd' and run the Hardware tests to see if it finds anything.

Maybe you are looking for

  • [Forum FAQ] Show Attachments in SharePoint 2013 Custom List View

    Introduction: By default, there is an Attachments column in the SharePoint List, some people want to display attachments name and click name can open the documents in List View. In this article, we would show you the method with REST API, JSLink and

  • Drill down more than one characteristic at the same time.

    Hi, Is there any way to drill down more than one characteristic at the same time? When I drill down by 0cust_sales I would like to have drilled down: division/distrchan/salesorg/cust_sales without having to do that one by one. thank you!

  • Problem related to locking the table

    Hi all, i am facing a problem while applying locks on the oracle table.my intention is stop the accessing of table to other users, if the table is locked by one user. for this i wrote the code as follows Class.forName("oracle.jdbc.driver.OracleDriver

  • ABAP Documentation and Examples

    Hi everybody, I have the Testdrive N4S here on my SuSE 10.3 and I'm trying to learn a bit about ABAP by viewing the Examples under ABAPDOCU. So far I can see the code but not the documentation. When doubleclicking on the red "?" icon I get an Informa

  • How to use CC for fonts?

    I can't find some fonts I want to use, thru my CC puchase and Type Kit... Am I using this wrong?