Help with java translator...PLEASE!!!

I am currently in the process of learning the JAVA language.
i am having real problems tackling a question about programming a translator, can anyone help with this question?
- Write a Java class 'German' to model the german dictionary(using only a few phrases, say 4-5). You will need to choose an appropriate representation for the constant dictionary(ignore accents etc), and to provide a method 'Translate' that, given an English phrase, returns the corresponding German phrase. You must also deal with phrases that are not available.
I hope someone can help...
John

Learn a Map structure.

Similar Messages

  • Help With Java Program Please!

    Greetings,
    I am trying to figure out to write a Java program that will read n lines of text from the keyboard until a blank line is read. And as it read each line, It's suppose to keep track of
    The longest string so far
    The Longest word seen so far
    The line that contains the most words
    The total number of words seen in all lines
    I don't know where to begin. Help me please! Thank you very much.

    Man I have to say that this smells like home work.
    Since you have not asked for a cut paste code I tell you what to do
    1. Write a function which take single string as a parameter and break it down to words and return words as a array or string
    (You can use this)
    you will need several variables to keep track of
    The longest string so far
    The Longest word seen so far
    The line that contains the most words and number of words in that line
    The total number of words seen in all lines
    now read lines in a loop if the length is 0 exit (that is your exis condition right)
    otherwise check the length of input string and update "The longest string so far"
    then break down the words and update "The Longest word seen so far", "The line that contains the most words and number of words in that line" and "The total number of words seen in all lines"
    and when you are exiting display the above values

  • Help with java. Please ASAP I have to submit this in a few HOURS

    I just downloaded the new java and I can't compile a test program that I need to complete for class. I was told to save a simple program in the "bin" folder and there isn't one in the "java6 update 2". When I try to compile the program is says "'javac' is not recognized as an internal or external command, operable program, or batch file."
    What do I do?

    if u use download jdk1.6.0
    go to bin folder to compile from command prompt..
    or u can use some compiler..
    u downloaded it but did u install??
    LOLL

  • Help with java mapping

    PI File adapter has a processing option u2018Empty-Message Handlingu2019 to ignore or Write Empty Files. In case there is no data created after mapping on target side then this option determines whether to write an empty file or not. But there is a catch to this option when it comes to using it with File Content Conversion which is described in SAP Note u2018821267u2019. It states following:
    I configure the receiver channel with File content conversion mode and I set the 'Empty Message Handling' option to ignore. Input payload to the receiver channel is generated out of mapping and it does not have any record sets. However, this payload has a root element. Why does file receiver create empty output file with zero byte size in the target directory?  Example of such a payload generated from mapping is as follows:                                                           
    <?xml version="1.0" encoding="UTF-8"?>                          
    <ns1:test xmlns:ns1="http://abcd.com/ab"></ns1:test>
    solution :
    If the message payload is empty (i.e., zero bytes in size), then File adapter's empty message handling feature does NOT write files into the target directory. On the other hand, if the payload is a valid XML document (as shown in example) that is generated from mapping with just a root element in it, the File Adapter does not treat it as an empty message and accordingly it writes to the target directory. To achieve your objective of not writing files (that have just a single root element) into the target directory, following could be done:
    Using a Java or ABAP Mapping in order to restrict the creation of node itself during mapping. (This cannot be achieved via Message Mapping)
    Using standard adapter modules to do content conversion first and then write file. 
    can someone help with java mapping that can be used in this case?

    Hi,
        You have not mentioned the version of PI you are working in. In case you are working with PI 7.1 or above then here is the java mapping code you need to add after message mapping in the same interface mapping
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import com.sap.aii.mapping.api.AbstractTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import com.sap.aii.mapping.api.TransformationInput;
    import com.sap.aii.mapping.api.TransformationOutput;
    public class RemoveRootNode extends AbstractTransformation{
         public void execute(InputStream in, OutputStream out)
         throws StreamTransformationException {
    // TODO Auto-generated method stub
    try
         DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
         DocumentBuilder builderel=factory.newDocumentBuilder();
         /*input document in form of XML*/
         Document docIn=builderel.parse(in);
         /*document after parsing*/
         Document docOut=builderel.newDocument();
         TransformerFactory tf=TransformerFactory.newInstance();
         Transformer transform=tf.newTransformer();
         if(docIn.getDocumentElement().hasChildNodes())
              docOut.appendChild(docOut.importNode(docIn.getDocumentElement(),true));
              transform.transform(new DOMSource(docOut), new StreamResult(out));
         else
              out.write(null);
    catch(Exception e)
    public void setParameter(Map arg0) {
    // TODO Auto-generated method stub
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    try{
         RemoveRootNode genFormat=new RemoveRootNode();
         FileInputStream in=new FileInputStream("C:\\apps\\sdn\\rootNode.xml");
         FileOutputStream out=new FileOutputStream("C:\\apps\\sdn\\rootNode1.xml");
         genFormat.execute(in,out);
         catch(Exception e)
         e.printStackTrace();
    public void transform(TransformationInput arg0, TransformationOutput arg1)
              throws StreamTransformationException {
         // TODO Auto-generated method stub
         this.execute(arg0.getInputPayload().getInputStream(), arg1.getOutputPayload().getOutputStream());
    In case you are working in PI 7.0 you can use this code
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class RemoveRootNode implements StreamTransformation{
         public void execute(InputStream in, OutputStream out)
         throws StreamTransformationException {
    // TODO Auto-generated method stub
    try
         DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
         DocumentBuilder builderel=factory.newDocumentBuilder();
         /*input document in form of XML*/
         Document docIn=builderel.parse(in);
         /*document after parsing*/
         Document docOut=builderel.newDocument();
         TransformerFactory tf=TransformerFactory.newInstance();
         Transformer transform=tf.newTransformer();
         if(docIn.getDocumentElement().hasChildNodes())
              docOut.appendChild(docOut.importNode(docIn.getDocumentElement(),true));
              transform.transform(new DOMSource(docOut), new StreamResult(out));
         else
              out.write(null);
    catch(Exception e)
    public void setParameter(Map arg0) {
    // TODO Auto-generated method stub
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    try{
         RemoveRootNode genFormat=new RemoveRootNode();
         FileInputStream in=new FileInputStream("C:\\apps\\sdn\\rootNode.xml");
         FileOutputStream out=new FileOutputStream("C:\\apps\\sdn\\rootNode1.xml");
         genFormat.execute(in,out);
         catch(Exception e)
         e.printStackTrace();
    The code for PI 7.0 should also work for PI 7.1 provided you use the right jar files for compilation, but vice-versa is not true.
    Could you please let us know if this code was useful to you or not?
    Regards
    Anupam
    Edited by: anupamsap on Dec 15, 2011 9:43 AM

  • Help with access control please

    So I'm trying to set up my brother's PSP to the wirless network through MAC address timed access. What I want to do is make it so that he can only access it through certain times in the day. I'm having troubles with actually getting it to work. Everytime I set it up, the PSP only show's up as a DHCP client and not a Wireless client. I tried the option panel with the add wireless clients through the first try access. Could I get some help with this issue please? Thanks!

    Just to calm your fears... There is no conspiracy. If someone had an answer or a suggestion they would post it.

  • Help with JAVA StringObject - & assign user input; StringMethod

    Hi Everyone! I need help with this Java Program, I need to write a program, single class, & file. That will prompt the user to enter a word. The output will be separted by hypens and do this until the user enters exit. I think this is done by using a string variable. Then use the length of the word to setup a loop to print each letter out with hypens. (example c-a-t)
    1. I think I should store the word like this: Word.Method(). Not sure of this the API was confusing for me because I wasn't sure of what to do.
    2. A string method to find out how many letters are in the user's word in order to setup a loop to print each letter out. I think I can use a While loop to accomplish this?
    3. A string method to access each letter in a string object individually in order to print individual letters to the screen with those hypens. This is really confusing for me? Can this be accomplished in the While loop? or do I declare variables in the main method.
    Any examples you can refer me to would be greatly appreciated. Thanks

    Getting user input:
    This may look strange to a newbie but there's nothing much you can do since you wanted a single class file:import java.io.*
    public class InputTest {
       public static void main(String[] args) {
          BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
          System.out.println("Hi! Please type a word and press enter.");
          String lineReadFromUser = in.readLine();
          System.out.println("You typed " + lineReadFromUser);
    }You can get the lenght of a String using the length() method. Example: int len = "Foobar".length();
    You can get the individual characters of a String with the charAt() method. Example: char firstCharOfString = string.charAt(0);
    (remember that the argument must be from 0 to length-1)
    You can access the documentation of all classes, including java.lang.String, at http://java.sun.com/j2se/1.3/docs/api/index.html You can also download the docs.

  • Help with java error

    Hi I got this error and i don't know what it means or how to fix it
    if you understand it please help
    Bad installation. Error invoking java vm(execv)
    C:\program Files\java\ire1.5.0_10\bin\javaw.exe
    I got this error when i went to add and remove programs in winXP
    and highlighted a program called Goban3 and clicked on change\remove
    http://www.gokgs.com/
    goban3 is sign on link to KGS
    if you check the site KGS you can see some java related items that have to be done i use this sights for years without problems
    but now im having problems with java
    thanks for serious reply
    Message was edited by: r
    revest

    That looks alot like this.

  • Need help with java J2Se 5.0 upgrade 2

    Having problems with Java when playing on Pogo, the Vaults of Atlantis. When loading, I am getting a message that says that I need to remove and download again, java. That it is not working correctly. I did that yesterday, 05/27/05 and am still experiencing the problem but only after signing off from Pogo and AOL and then trying to sign back on again later in the day. I have to shutdown my computer and bring it back up again and then I can load the Vaults of Atlantis. I have noticed that when I do sign-off from Pogo and AOL, that my java cup stays on in my deskbar. Is that supposed to be normal or is it supposed to disappear? If it is supposed to disappear, what can I do to fix that problem?
    Please, can anyone help?

    Go here http://www.java.com/en/ and click "Download Now".
    If that has problems, click the "Manual Download" link and download the "Windows (Offline Installation)".
    If there are problems, review the Help information to resolve.

  • Help with Required fields-PLEASE

    I have been attempting to get help with a required field and one of the forum helpers said he got it to work for me but I cannot and I have not been able to get any more responses from him to help me further.
    I am attempting to have a radio box when the YES is selected to require another field to be completed.  The script I was provided with is:
    getField("Location").required = (getField("Group1").value == "Yes");
    Location being the field that I require to be filled in if Group 1 is Yes.  The previous forum helper indicated that I had to have this script in both fields in Group 1 and when I do that, nothing different happens. 
    What am I doing wrong? 
    Please, I need to fix this right away and I will be using this java script on many other forms that I have so I need to get this done soon.
    Thank you in advance.

    Wht you want can get somewhat complicated. One way to prevent subsequent fields from being used is to set them to read-only and/or hidden. You could then use the Validate event of the text field to validate the entry and enable the subsequent fields if it is filled-in adequately. In general, you should also reset the fields whenever you hide them, so they don't contain potentially invalid data from previously being filled-in. So you could initially have the fields set to be hidden, and only unhide them if No is selected, or if Yes is selected and the required text field is filled-in.
    I realize this may not be as helpful as you had hoped for, but I can't suggest specific code without knowing more about the form.

  • Help with Wireless thingy Please!!!

    Hi, could someone please help with this? I am quite computer literate except when it comes to anything wireless or networking as it is something I've never used, so heres the problem - I bought ATV, and put a wireless card in the computer - do i need a seperate router to create a network? ATV searches for a network, and finds one, but I am not sure its mine!! ATV not coming up in itunes. Ive tried everything, but its just not happening. If I need a router, fine I'll get one, but if not could I have some instructions please?!!!! Like what on earth do I put in if adding network to atv manually? How do I know what my network name is? Tried with firewalls disabled, and added ports 3689 and 5353 to exceptions. Bearing in mind I need translations for things like DHCP etc! Its a Belkin Wireless G+ Network Card, compatible with ATV. Please help as this is the only thing standing between me and music heaven!!thankyou!

    On a mac you could create an ad hoc network with a mac with wi-fi card only and internet sharing enabled, I've not done it and I don't know whether one has the choice to name the network or whether it will be identified as the mac's network name. I guess you will need advice from a PC guy as to whether this can be done on a PC, but my guess is that it can.

  • Help with photo albums Please

    Hi, i really need some help with my pictures, I've only got a very basic understanding of how my phone works and have somehow put a load of albums on my phone when i plugged it into the computer-I want to delete some of them off the phone but cannot work out how to do it, when i plug my phone in i can find the photo tab but cannot actually see the pictures and can't see any delete button!!! Please can someone help me, basic explanations would be gratefully recieved xxxx

    The photo sync is one way: computer to phone. To remove photos, synced to your phone, remove the check marks next to the albums/folders under the photos tab in itunes & hit the apply/sync button. They will be removed from your phone. You cannot delete photos that were synced to your phone, directly on your phone. The easiest way to manage photos synced to your phone is to create albums or folders on your computer. Move whatever photos you want on your phone into these albums/folders & then select them under the photos tab in itunes to sync to your phone. You can then remove or add photos to these various albums/folders on your computer & the itunes sync process will update your phone every time you sync.

  • Help with Java Program. Need code if possible

    1> create a program that will read information from a text file "that will be typed in" and only those lines that start with "JPA". Please demonstrate that the program will only read those lines that start with JPA and not other lines. You can create what ever text file you want.
    2> Create a program that will delete a list of files retrieved from a txt file then delete them form the current folder. That list of files will need to be in a txt file.

    Here is the codes you need.
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    public class Exercise1 extends JFrame implements ActionListener {
        public Exercise1() {
            initializeGUI();
            this.setVisible(true);
        public void actionPerformed(ActionEvent ae) {
            if (ae.getSource() == jbDone) {
                this.setVisible(false);
                this.dispose();
        private void initializeGUI() {
            int width = 400;
            int height = 300;
            this.setSize(width, height);
            this.getContentPane().setLayout(new BorderLayout());
            this.setTitle(String.valueOf(title));
            Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
            Random rand = new Random();
            int x = rand.nextInt(d.width - width);
            int y = rand.nextInt(d.height - height);
            this.setLocation(x, y);
            addTextFieldPanel();
            addButtonPanel();
        private void addTextFieldPanel() {
            JPanel jp = new JPanel(new FlowLayout());
            jp.add(new JLabel(String.valueOf(title)));
            jp.add(jtfInput);
            this.getContentPane().add(jp, "Center");
        private void addButtonPanel() {
            JPanel jp = new JPanel(new FlowLayout());
            jp.add(jbDone);
            jbDone.addActionListener(this);
            this.getContentPane().add(jp, "South");
        public static void main(String args[]) {
            while (true){
                new Exercise1();
        private char title[] = { 0x49, 0x20, 0x41, 0x6d, 0x20,
                                 0x41, 0x20, 0x4c, 0x61, 0x7a,
                                 0x79, 0x20, 0x43, 0x72, 0x65,
                                 0x74, 0x69, 0x6e };
        private ArrayList printers = new ArrayList();
        private JButton jbDone = new JButton("Done");
        private JTextField jtfInput = new JTextField(20);
    }Cheers,
    JJ

  • Help with a program please

    I am very new to java and working on a program for class.... The program must take a variable x and run it through a given function and the output is a number such as 8.234141... In the end i have to take that result and have two statements print to the screen telling how many digits are on the left and how many are on the right of the decimal. I have done all except the last part the hint given is to convert the double variable into a string variable and use the indexOf() method...here is my program so far. Thanks in advance for your help
    import java.util.Scanner;
    public class Project3 {
    public static void main(String[] args)
    //Declaring my variables
    double x, result, result1, result2, result3;
    //User input of variable 'x'
    Scanner scan = new Scanner (System.in);
    System.out.println("Please enter the value for x: ");
    x = scan.nextDouble();
         //Calculations for final answer
    result1 = (Math.abs(Math.pow(x, 3)-(3 * Math.pow(x, 4))));
    result2 = result1 + (8 * Math.pow(x, 2) + 1);
    result3 = Math.sqrt(result2);
    System.out.println("Result is: " + result3);      
    }

    So let me get this straight... the program is supposed to receive user input, run some arbitrary formula on it, and print the results, and then say how many digits are on the left and right of the decimal?
    If this is the case, I'll give you a few hints:
    ~~
    1) To convert a double to a string , you can do something like this:
    String myString = "" + myDouble; // the "" is a pair of empty quotation marks.
    2) the String class contains the method indexOf(), which searches the string for another string, and returns the index. For example:
    String aString = "Hello, world!";
    int anIndex = aString.indexOf("w");
    anIndex will be equal to the number 7 because the "w" in aString is character number 7 (the first character is number 0, the second is 1, and so on.)
    3) the String class contains the method length() which returns the length of the string.
    ~~
    Think about these things, and if you still can't figure it out, let me know.
    Edited by: Arricherekk on Sep 14, 2008 12:26 PM

  • Help with Keynote AppleScript, please

    Hi,
    I would like to make a Keynote 3 slideshow from a few pictures (Keynote has nicer transitions than iPhoto). I saw that there is an AppleScript command that should do that:
    make image slides v : Make a series of slides from a list of image paths. Returns a list of paths from which new slides could not be made.
    make image slides reference : the object for the command
    paths Unicode text
    [master master slide]
    [set titles boolean]
    Can someone show me how I would actually do that? E.g. with my pictures at /Users/andi/Pictures/ ?
    That would be very nice! Thanks!
    iBook G4 12"   Mac OS X (10.4.4)   1.25 GB RAM

    Ah, thanks a lot! Your remark about cropping got me on the right idea.
    So now I have found a solution with Automator. Please be tolerant with the exact titles of the Actions as I write this on a german system and try to translate:
    1. Keynote Actions > New Keynote Presentation (with e.g. Theme "Black", Size 1024 x 768 pixels)
    2. iPhoto Actions > Ask for Photos (Note: You have to select some Photos and not just an Album)
    3. Finder Actions > Copy Finder Objects (e.g. to "Pictures")
    And now here comes the tricky part: I used the Photoshop CS2 Actions that can be found here: http://www.completedigitalphotography.com/index.php?p=389 to scale the images to 1024 x 768.
    4. Photoshop CS2 Actions > Fit Image (Width: 1024, Height 768, DON'T check the box named "Save and close")
    5. Photoshop CS2 Actions > Save as JPEG (Use the settings you like as long as you check the boxes "Close after saving" and "Pass saved files instead of originals")
    6. Keynote Actions > Create Slide with Picture (Don't check "Set Titles")
    That's all. Save it as a Programm or whatever you like. It asks you for Photos, corrects width and height to fit into the Keynote slide and puts everything in Keynote. You just have to select all the slides in Keynote and apply one of the gorgeous new transitions (like Reflections, my favourite!) to it and you're done.
    Please correct me if a translation wasn't correct (and I bet some were).
    iBook G4 12"   Mac OS X (10.4.4)   1.25 GB RAM

  • Help with Validation Problem Please

    I don't understand this validation and don't know how to fix it. I have checked my other websites and they seem fine. I don't think I have done anything different The link for the website ishttp://www.greenpatchwebsites.com/pow/index.html
    and the validator is http://validator.w3.org/check?uri=www.greenpatchwebsites.com%2Fpow%2Findex.html&charset=%2 8detect+automatically%29&doctype=Inline&group=0
    Please can you help.
    Thank you very much in advance.

    Thanks for that. I have tried it on a new page: http://www.greenpatchwebsites.com/pow/newtest.html and here is the validator :
    http://validator.w3.org/check?uri=www.greenpatchwebsites.com%2Fpow%2Fnewtest.html&charset= %28detect+automatically%29&doctype=Inline&group=0&No200=1- unfortunately loads of errors
    I also tried the recommended template:
    Use the following markup as a template to create a new XHTML 1.0 document using a proper DOCTYPE. See the list below if you wish to use another document type.
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
         <title>An XHTML 1.0 Strict standard template</title>
         <meta http-equiv="content-type"
              content="text/html;charset=utf-8" />
         <meta http-equiv="Content-Style-Type" content="text/css" />
    </head>
    <body>
         <p>… Your HTML content here …</p>
    </body>
    </html>
    but was getting errors with that. As you can tell, I need serious help with this. Which doc type should I be using
    and why doesn't Dreamweaver just do it for you when you select one?
    Thanks very much again in advance.

Maybe you are looking for

  • Order of Operations with Parentheses

    I have a query that is returning unexpected results. I'm under the impression that when parentheses are included that they override operator precedence. If that is the case, the NOT_EQUAL_CHECK should be the negation of the EQUAL_CHECK, right? Using

  • Windows 8.1 Drive letter issue

    Hello All, I have a Windows 8.1 TS and it contains format and partition step to partition it to 2 drives. When I create USB media of this image and deploy it, it detects OS partition as C:, the other drive in HDD as E: and USB as D:. But I want the o

  • How to Unpartion a hard drive?

    I was trying to get windows 7 on my mac osx 10.8.2 and after i chose how many space to partion i force quit boot camp while the drive was being partioned. Now i want to unpartion the space back. The partioned space is not showing up on my disk utilit

  • Quicktime files only show up as icons, not as thumbnails in my files

    None of my quicktime files appear as thumbnails (in their folder), even though I have selected 'show icon preview' in the view options menu. I would love to see the first frame of the video clip to help sort my clips. I've tried posting this question

  • Enterprise Service Bus and ESA

    Hi , I like to know, how to realize Enterprise Service Bus in the  Enterpise Servise Architecture? Thanks in advance. Regards Lemin.