Help with string object code

Hello,
First off thanks in advance to anyone who helps. I am trying to write a program that using a class string object to convert this kind of "text speech" to english. For example if the user inputs "HowAreYou?", I want the program to output "How are you?" I am having too much trouble with strings for some reason. This is what I have so far and I am not sure where to go from here. Should I use a do loop to check through the input string until it is done seperating the words? And how should I go about doing that?
import java.util.Scanner;
public class P8
public static void main( String args[] )
char choice;
String line = null;
String answer = null;
Scanner scan = new Scanner(System.in);
do
System.out.println();
System.out.print("ENTER TextSpeak sentence(s): ");
line = scan.nextLine();
System.out.print( "Converted to English: \t ");
System.out.print( textSpeaktoEng( line ) );
System.out.println();
System.out.print("Want more TextSpeak?\t\t ");
answer = scan.next();
choice = answer.charAt(0);
if( scan.hasNextLine() )
answer = scan.nextLine();
}while(choice != 'N' && choice != 'n');
public static String textSpeakToEng(String s)
String engStr = null;
if( Character.isUpperCase( s.charAt(j) ) )
engStr += ? ?;
engStr += Character.toLowerCase( s.charAt(j) );
scan.close();
}

I got my program to compile and run but I have a problem. If I input something like "ThisForumIsGreat" it will output just "t f i g" in lower case letters. Any suggestions?
import java.util.Scanner;
public class P8
public static void main( String args[] )
   char     choice;                          // Repeat until n or N                                             
   String line   = null;                     // Sentences to toTextSpeak
   String answer = null;                     // Repeat program scan
   Scanner scan = new Scanner(System.in);    // Read from keyboard
   do
      System.out.println();
      System.out.print("ENTER TextSpeak sentence(s): ");
      line = scan.nextLine();                // Read input line
      System.out.print( "Converted to English: \t    ");
      System.out.print( textSpeakToEng( line ) );
      System.out.println();
      System.out.print("Want more TextSpeak?\t\t ");
      answer = scan.next();                  // Read line, assign to string
      choice = answer.charAt(0);             // Assign 1st character
      if( scan.hasNextLine() )               // <ENTER> character
        answer = scan.nextLine();            // Read line, discard
  }while(choice != 'N' && choice != 'n');    // Repeat until input start n or N
public static String textSpeakToEng(String s)
   String engStr = null;  
   int i;  
   for ( i = 0; i < s.length(); ++i )
   if( Character.isUpperCase( s.charAt(i) ) )
     engStr += " ";                                  // Append 1 blank space
     engStr += Character.toLowerCase( s.charAt(i) ); // Append lowercase
   return( engStr );
}

Similar Messages

  • Help with View Objects code

    I need to add some new methods to my source code of an View Object (ej. KssegtrolesImp.java) and call them in my jsp pages. In that file we have by default methods as:
    create(), doDML(), etc..
    I added new methods but I don`t know how to do to call that method on an Entity Object.
    Please I really need some help.

    Hi Gina,
    I'm not quite sure I understand--Do you need to call View Object methods or Entity Object methods?
    It sounds like you want to call Entity Object methods, if I understand correctly. You can't do that directly, because clients don't directly access the Entity Object layer.
    You can instead access these from a View Row. I'm about to post a HowTo on accessing EO methods this way.
    Best,
    Avrom
    null

  • Using intern() with String objects

    Hi, I was wondering if anybody could explain to me more about using the method intern() with String objects.
    Suppose I have a String, say testString1.
    I want to make it uppercase and I would like to refer to it/use it in many places in the code.
    Does using the statement
    testString1.toUppercase().intern()
    put the uppercase testString1 in some kind of a pool? so that everytime I call testString1.toUppercase(), a new testString1 in uppercase is not created each time? Instead it is taken from the pool? Is that how this works?
    I would appreciate a response from anybody who knows about this stuff.
    Thanks.

    No !!!... It doesn't work that way.
    I would recommand you (and anyone alse) not to use String.intern() unless you have a COMPLETE understanding of how it works.

  • Need help with a activation code for Adobe Acrobat X Standard for my PC,, Don't have older version serial numbers,  threw programs away,  only have Adobe Acrobat X Standard,  need a code to unlock program?

    Need help with a activation code for Adobe Acrobat X Standard for my PC, Don't have older Version of Adobe Acrobat 9, 8 or 7. 

    You don't need to install the older version, you only need the serial number from your original purchase. If you don't have them to hand, did you register? If so, they should be in your Adobe account. If not you really need to contact Adobe, though it isn't clear they will be able to do anything without some proof of purchase etc.

  • Help With String parsing

    Hey guys,
    I need some help with String Parsing. i hope experts here will help me.
    i'm reading a text file and getting data as String in this format
    *ABR, PAT MSSA        2009       7001    B   ABC       Y
    *VBR, SAT ZSSA        2008       5001    A   CED       N
    *ABC, AAT CSSA        5008       001     A   AZX       N
    *CBC, CAT FSSA        308        5001    A   XCV       N
    Now from following lines i have to extract Number data i.e. 2009 and 7001 from 1st line. 2008 and 5001 from 2nd line and so on.
    Can anyone pls suggest me any way to get the data that i want from these Strings
    Thanks for your time to read this.
    Regards,
    sam

    Thanks for the reply
    Data length can vary. ABR, PAT is the last name, First Name of the Users.
    it can be following or any other combination. i just need 2 set of numbers from the complete line rest i can ignore. Any other way to get that
    *ABRaaassd, PATfffff MSSA 2009 7001 B ABC Y
    *VBRaa, SATaa ZSSA 2008 5001 A CED N
    *ABC, AAT CSSA 5008 001 A AZX N
    *CBC, CAT FSSA 308 5001 A XCV N                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • HT3209 Purchased DVD in US for Cdn viewing. Digital download will not work in Cda or US? please help with new Digital code that will work

    Purchased DVD in US for Cdn viewing. Digital download will not work in Cda or US? please help with new Digital code that will work

    You will need to contact the movie studio that produced the DVD and ask if they can issue you a new code valid for Canada. Apple cannot help you, and everyone here in these forums is just a fellow user.
    Regards.

  • Would like help with treeset ,the codes that using for sorting, please ?

    hi every body. i faced a problem while writing this program, everything worked properly except this one. The program is related to Jframe and it asks the user to add three labels , three text field , one text area and three Jbuttons which are add sort and exit. i could deal with add and exit but sort, i couldn't do it properly because i don't know the codes that should be added in actionperfomed?
    These codes are :
    package gui;
    import javax.swing.SwingUtilities;
    import java.awt.BorderLayout;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import java.awt.Rectangle;
    import java.util.ArrayList;
    import javax.swing.JButton;
    import javax.swing.JTextField;
    import javax.swing.JTextArea;
    import sun.misc.Sort;
    import domain.Student;
    public class StudentFrame extends JFrame {
          * This method initializes btnAdd     
          * @return javax.swing.JButton     
         private JButton getBtnAdd() {
              if (btnAdd == null) {
                   btnAdd = new JButton();
                   btnAdd.setBounds(new Rectangle(13, 135, 59, 27));
                   btnAdd.setText("Add");
                   btnAdd.addActionListener(new java.awt.event.ActionListener() {
                        public void actionPerformed(java.awt.event.ActionEvent e) {
                        btnAddClicked(); // TODO Auto-generated Event stub actionPerformed()
              return btnAdd;
         protected void btnAddClicked() {
              // TODO Auto-generated method stub
         String name = txtName.getText();
         String id = txtID.getText();
         String age = txtAge.getText();
         Student s = new Student(name , id , age);
         txtArea.setText(String.valueOf(s ));
          * This method initializes btnSort     
          * @return javax.swing.JButton     
         private JButton getBtnSort() {
              if (btnSort == null) {
                   btnSort = new JButton();
                   btnSort.setBounds(new Rectangle(95, 136, 62, 25));
                   btnSort.setText("Sort");
                   btnSort.addActionListener(new java.awt.event.ActionListener() {
                        public void actionPerformed(java.awt.event.ActionEvent e) {
                             btnSortClicked(); // TODO Auto-generated Event stub actionPerformed()
              return btnSort;
         protected void btnSortClicked() {
              // TODO Auto-generated method stub
          * This method initializes btnExit     
          * @return javax.swing.JButton     
         private JButton getBtnExit() {
              if (btnExit == null) {
                   btnExit = new JButton();
                   btnExit.setBounds(new Rectangle(173, 134, 61, 23));
                   btnExit.setText("Exit");
                   btnExit.addActionListener(new java.awt.event.ActionListener() {
                        public void actionPerformed(java.awt.event.ActionEvent e) {
                             System.exit(0); // TODO Auto-generated Event stub actionPerformed()
              return btnExit;
          * This method initializes txtName     
          * @return javax.swing.JTextField     
         private JTextField getTxtName() {
              if (txtName == null) {
                   txtName = new JTextField();
                   txtName.setBounds(new Rectangle(79, 11, 60, 23));
              return txtName;
          * This method initializes txtID     
          * @return javax.swing.JTextField     
         private JTextField getTxtID() {
              if (txtID == null) {
                   txtID = new JTextField();
                   txtID.setBounds(new Rectangle(73, 55, 65, 26));
              return txtID;
          * This method initializes txtAge     
          * @return javax.swing.JTextField     
         private JTextField getTxtAge() {
              if (txtAge == null) {
                   txtAge = new JTextField();
                   txtAge.setBounds(new Rectangle(74, 96, 61, 24));
              return txtAge;
          * This method initializes txtArea     
          * @return javax.swing.JTextArea     
         private JTextArea getTxtArea() {
              if (txtArea == null) {
                   txtArea = new JTextArea();
                   txtArea.setBounds(new Rectangle(138, 5, 154, 128));
              return txtArea;
          * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        StudentFrame thisClass = new StudentFrame();
                        thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                        thisClass.setVisible(true);
          * This is the default constructor
         public StudentFrame() {
              super();
              initialize();
          * This method initializes this
          * @return void
         private void initialize() {
              this.setSize(300, 200);
              this.setContentPane(getJContentPane());
              this.setTitle("JFrame");
              return jContentPane;
    }Edited by: hypocrisy on Apr 26, 2009 6:51 PM

    There are three actionPerformed in that program.One for add Jbutton , Sort , and Exit
    the codes that i have added for add button after action performed are
    String name = txtName.getText();
    String id = txtID.getText();
    String age = txtAge.getText();
    Student s = new Student ( name , id , age);
    System.out.println(s);
    the codes for Exit button to make it works properly was :
    System.out.println(0);
    But when i came to Sort Button and i tried to enter many codes but it didn't sort properly so would you like to help me with the right codes :)

  • Using == with String object references

    Hi,
    I understand that using the == operator to compare two String object references in Java will yield false for two different object references even when the contents are the same, and that you are supposed to use the method .equals() instead. However, in my program the == operator actually works for two different object references that point to the same object since it yields true! I don't understand why it works in my program when it shouldn't. Does someone know why?
    Thanks!

    overrule. wrote:
    warnerja wrote:
    ... unless some sneaky thread jumps in and changes the a or b reference right before the expression (a == b) were evaluated. This would also assume a or b had greater scope than simply local method variables that only one thread could access.
    Just being a nitpickCould you provide an example of how that "greater scope" may look like in this case.
    * Greater scope.
    * @author Cynthia G.
    * @see http://forums.sun.com/thread.jspa?messageID=10520796
    public class ObjectAssignmentTest {
      static Object a; // outer scope: class variable
      static Object b; // outer scope: class variable
      public static void main(String[] args) throws InterruptedException {
        a = new Object();
        b = a;
        new Thread(new Runnable() {
          public void run() { ObjectAssignmentTest.b = new Object(); }
        }).start();
        System.out.println(a == b ? "equal" : "not equal");
    }For the record, this code is not even guaranteed to make the objects unequal with == before their equality is tested; both threads may go in parallel, the main thread first or the modifying thread first!
    s

  • I need help with a Object Array

    I am having trouble and this maybe really simple seeing that I am fairly new to java but I have text that is being broken down in to preset part with those parts stored in Object arrays.
    Now I also have a object array inside my object array. Within the second object array are the broken down parts of the text and I want to compare this text with another string so for example this is what I am trying
    boolean found = false;
    for (int i = 0; i < FirstObjectArray.length ;i++)
         Object[] SecondObjectArray = (Object[]) FirstObjectArray;
         if(SecondObjectArray[0] == "string")
              found = true;
              break;
         else
              found = false;
    }Help would be very appreciated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    astlanda wrote:
    Sure, you're right.
    [public boolean equals(Object obj)|http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#equals%28java.lang.Object%29]
    sharkura said all the OP needs at the moment. I just wanted to clarify a bit why You don't use == 99.999% of the time with objects, and never with String.
    I have argued elsewhere in these forums that it is inappropriate to tell anyone that you never use == to compare objects. This has not always been accepted. I have, on rare occasions, known experienced developers to blindly compare two objects with equals(), and cite the professor that taught them, 15 years iin the past, that object references are never compared using ==, but always with equals().
    However, the cases where == is appropriate and equals() is not are indeed rare, but not, in my experience, non-existent. In my statement, I probably exaggerated. And String is a case where I can probably accept that you will probably never go wrong with equals(). If the String has been pooled (see String::intern()), you can actually use either. From the javadocs: "*It follows that for any two strings s and t, s.intern() == t.intern() is true if and only if s.equals(t) is true.*"
    ¦ {Þ                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Help with some beginner code

    Hello, I am new to java and I need a bit of help with some code that I'm writing. here is the code:
    import javax.swing.*;
    public class Test{
         public static void main(String[] args){
         JOptionPane.showMessageDialog(null,"We will now build a block with *'s","Block",1);
         String input=JOptionPane.showInputDialog(null,"Type a number: ","Number",3);
         int number=Integer.parseInt(input);
         int count=0; int count2=0;
         for(count2=0; count2<number; count2++){
              for(count=0; count<number; count++){
              System.out.print("* ");
    System.exit(0);
    }Now, all I need is to build a block of *'s with the number that the user inputs. With the code that I wrote I get the correct number of *'s but not in the form of a block. They just print out in a straight line. I know this is a very simple task but could someone please help me out? What do I need to modify in my code so that the *'s print out arranged as a block like so:
    **********

    Your code only uses the print method which prints without a carriage return/line feed. So you need to add a line of code to print a carriage return/line feed. Where? well that is your task to work out.

  • Help with String/ and or Array loading and comparing

    Hi all,
    I'm having some problems with trying to find the best way to achieve the following on a Poker Dealing program. I randomly shuffle a 52 card deck of playing cards and deal out 5 cards. Cool...
    Now I have to go back thru the String and determine if my hand of cards contains
    a pair
    2 pair
    3 of a kind
    Full House
    etc etc
    I am trying to do String comparisons (there is an empty compareCards method in my code right now, but I'm getting a bit frustrated as to find the best way to do it... Would an array load in a separate method be a better way???? What I need to do is after I load my hand , is to display a message stating a pair, 3 of a kind , etc etc.....
    Thanks in advance
    Mike
    Here is my code (please don't laugh too hard - I'm an old COBOL/Oracle guy):
    // Card shuffling and dealing program
    // Java core packages
    import java.awt.*;
    import java.awt.event.*;
    // Java extension packages
    import javax.swing.*;
    public class DeckOfCards extends JFrame {
    private Card deck[];
    private Card hand[];
    private int currentCard;
    private JButton dealButton, shuffleButton;
    private JTextArea outputArea ;
    private JTextField displayField;
    private JLabel statusLabel;
    // set up deck of cards and GUI
    public DeckOfCards()
    super( "Poker Game" );
    String faces[] = { "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" };
    String suits[] = { "Hearts", "Diamonds", "Clubs", "Spades" };
    String display = "" ;
    deck = new Card[ 52 ];
    currentCard = -1;
    // populate deck with Card objects
    for ( int count = 0; count < deck.length; count++ )
    deck[ count ] = new Card( faces[ count % 13 ],
    suits[ count / 13 ] );
    // set up GUI and event handling
    Container container = getContentPane();
    container.setLayout( new FlowLayout() );
    // shuffle button
    shuffleButton = new JButton( "Shuffle cards" );
    shuffleButton.addActionListener(
    // anonymous inner class
    new ActionListener() {
    // shuffle deck
    public void actionPerformed( ActionEvent actionEvent )
    displayField.setText( "" );
    shuffle();
    displayField.setText( "The Deck is Shuffled" );
    statusLabel.setText( "" );
    } // end anonymous inner class
    ); // end call to addActionListener
    container.add( shuffleButton );
    // Deal button
    dealButton = new JButton( "Deal Hand" );
    dealButton.addActionListener (
    // anonymous inner class
    new ActionListener() {
    // deal 5 cards
    public void actionPerformed( ActionEvent actionEvent )
    outputArea.setText( "" ) ;
    displayField.setText( "" );
    for ( int cctr = 1 ; cctr <= 5; cctr++ ){     
    Card dealt = dealCard();
    if ( dealt != null ) {
    outputArea.append( dealt.toString()+"\n" );
    else {
    displayField.setText( "No more cards left" );
    statusLabel.setText( "Shuffle cards to continue" );}
    } // end for structure
    compareCards() ;
    } // end action
    } // end anonymous inner class
    ); // end call to addActionListener
    container.add( dealButton );
    outputArea = new JTextArea (10, 20) ;
    outputArea.setEditable( false ) ;
    container.add( outputArea ) ;
    displayField = new JTextField( 20 );
    displayField.setEditable( false );
    container.add( displayField );
    statusLabel = new JLabel();
    container.add( statusLabel );
    setSize( 275, 275 ); // set window size
    show(); // show window
    // shuffle deck of cards with one-pass algorithm
    public void shuffle()
    currentCard = -1;
    // for each card, pick another random card and swap them
    for ( int first = 0; first < deck.length; first++ ) {
    int second = ( int ) ( Math.random() * 52 );
    Card temp = deck[ first ];
    deck[ first ] = deck[ second ];
    deck[ second ] = temp;
    dealButton.setEnabled( true );
    public void compareCards()
    public Card dealCard()
    if ( ++currentCard < deck.length )
    return deck[ currentCard ];
    else {       
    dealButton.setEnabled( false );
    return null;
    // execute application
    public static void main( String args[] )
    DeckOfCards app = new DeckOfCards();
    app.addWindowListener(
    // anonymous inner class
    new WindowAdapter() {
    // terminate application when user closes window
    public void windowClosing( WindowEvent windowEvent )
    System.exit( 0 );
    } // end anonymous inner class
    ); // end call to addWindowListener
    } // end method main
    } // end class DeckOfCards
    // class to represent a card
    class Card {
    private String face;
    private String suit;
    // constructor to initialize a card
    public Card( String cardFace, String cardSuit )
    face = cardFace;
    suit = cardSuit;
    // return String represenation of Card
    public String toString()
    return face + " of " + suit;
    } // end class Card

    You could have the original face values as integers, thus Ace = 1, Jack = 11 (it'll be easy enough to display the proper values AJQK if you keep your string array and just display whatever corresponds to the value held in your int array).
    Each player gets an array of five cards. You could the loop through each hand and increment values held in another array by one according to the value of the card. Haven't coded the following up but it should work I think.
    // hand [ ] represents the cards held by that player
    int handChecker [ ] = new int [14]
    for (int counter = 0; counter < 5; ++ counter)
    // 1st card is an Ace. handChecker [1] will be incrementd by one and so on
    // 2nd card is a 9. handChecker[9] will be incremented by one.
    handChecker[hand[counter]] += 1;
    // Loop through the array handChecker to find pairs etc.
    boolean pair = false;
    bollean tofk = false;
    for (int counter = 1; counter < 14; ++ counter)
    if (handChecker[counter] == 2)
    pair = true;
    if (handChecker[counter] == 3)
    tofk = true;
    if (pair)
    // player has a pair
    if(tofk)
    // player has three of a kind
    if(pair && tofk)
    // player has a full house

  • Need a little help with program (long code)

    Jist of program: If User enters a zip code, convert it to bar code. If User enters a bar code, convert it to zip code. Below is the code for the classes. Question is how to get the constructors under the same class to where they can compile. I'm not sure what to do...Any help is definately appreciated
    public class BarCode
       public BarCode(int n)
          zip = n;
       public String getCode()
          String barCode = "|";
          int sum = 0;
          int temp = 0;
          temp = zip / 10000;
          sum = sum + temp;
          Digit d1 = new Digit(temp);
          barCode = barCode + d1.getCode();
          zip = zip % 10000;
          temp = zip / 1000;
          sum = sum + temp;
          Digit d2 = new Digit(temp);
          barCode = barCode + d2.getCode();
          zip = zip % 1000;
          temp = zip / 100;
          sum = sum + temp;
          Digit d3 = new Digit(temp);
          barCode = barCode + d3.getCode();
          zip = zip % 100;
          temp = zip / 10;
          sum = sum + temp;
          Digit d4 = new Digit(temp);
          barCode = barCode + d4.getCode();
          zip = zip % 10;
          temp = zip;
          sum = sum + temp;
          Digit d5 = new Digit(temp);
          barCode = barCode + d5.getCode();
          temp = 10 - (sum % 10);
          Digit d6 = new Digit(temp);
          barCode = barCode + d6.getCode() + "|";
          return barCode;
       private int zip;
    public BarCode(String aCode)
          code = aCode;
       public int getCode()
          if (code.length() != 2 + 6 * DIGITLENGTH)
            return -1;
          if (!code.substring(0, 1).equals("|"))
             return -1;
          int i = 1;
          int sum = 0;
          int dsum = 0;
          String codeDigit = code.substring(i, i + DIGITLENGTH);
          Digit d1 = new Digit(codeDigit);
          int val = d1.getCode();
          i = i + DIGITLENGTH;
          if (val < 0)
             return -1;
          sum = sum + val * 10000;
          dsum = dsum + val;
          codeDigit = code.substring(i, i + DIGITLENGTH);
          Digit d2 = new Digit(codeDigit);
          val = d2.getCode();
          i = i + DIGITLENGTH;
          if (val < 0)
             return -1;
          sum = sum + val * 1000;
          dsum = dsum + val;
          codeDigit = code.substring(i, i + DIGITLENGTH);
          Digit d3 = new Digit(codeDigit);
          val = d3.getCode();
          i = i + DIGITLENGTH;
          if (val < 0)
             return -1;
          sum = sum + val * 100;
          dsum = dsum + val;
          codeDigit = code.substring(i, i + DIGITLENGTH);
          Digit d4 = new Digit(codeDigit);
          val = d4.getCode();
          i = i + DIGITLENGTH;
          if (val < 0)
             return -1;
          sum = sum + val * 10;
          dsum = dsum + val;
          codeDigit = code.substring(i, i + DIGITLENGTH);
          Digit d5 = new Digit(codeDigit);
          val = d5.getCode();
          i = i + DIGITLENGTH;
          if (val < 0)
          return -1;
          sum = sum + val;
          dsum = dsum + val;
          codeDigit = code.substring(i, i + DIGITLENGTH);
          Digit d6 = new Digit(codeDigit);
          val = d6.getCode();
          i = i + DIGITLENGTH;
          if (val < 0)
             return -1;
          dsum = dsum + val;
          if (dsum % 10 != 0)
             return -1;
          if (!code.substring(i, i + 1).equals("|"))
             return -1;
          return sum;
       public boolean isValid()
          return true;
       private final int DIGITLENGTH = 5;
       private String code;
    public class Digit
        public Digit(int n)
          zip = n;
       public String getCode()
          String bar = "";
          if (zip == 1)
             bar = ":::||";
          else if (zip == 2)
             bar = "::|:|";
          else if (zip == 3)
             bar = "::||:";
          else if (zip == 4)
             bar = ":|::|";
          else if (zip == 5)
             bar = ":|:|:";
          else if (zip == 6)
             bar = ":||::";
          else if (zip == 7)
             bar = "|:::|";
          else if (zip == 8)
             bar = "|::|:";
          else if (zip == 9)
             bar = "|:|::";
          else
             bar = "||:::";
          return bar;
       private int zip;
    public Digit(String aCode)
          code = aCode;
       public int getCode()
          if (code.equals(":::||"))
             return 1;
          else if (code.equals("::|:|"))
             return 2;
          else if (code.equals("::||:"))
             return 3;
          else if (code.equals(":|::|"))
             return 4;
          else if (code.equals(":|:|:"))
             return 5;
          else if (code.equals(":||::"))
             return 6;
          else if (code.equals("|:::|"))
             return 7;
          else if (code.equals("|::|:"))
             return 8;
          else if (code.equals("|:|::"))
             return 9;
          else if (code.equals("||:::"))
             return 0;
          else return -1;
       public boolean isValid()
          return false;
       private String code;
    }

    Your squiggly braces are completely out of whack!
    Class definitions should be something like this:class ClassName
        public ClassName()    // one constructor
            // code here
        public ClassName(String someString)    // another constructor
            // code here
        public void someMethod()
            // code here
    class AnotherClass
        public void anotherMethod()
            // code here
    }For each opening curly brace { there must be exactly one closing curly brace }.
    Once you've gotten your curly braced figured out, you can deal with the multiple redefinitions of your methods. One step at a time, though.

  • Need help with adjusting Javascript code to work in Adobe Edge (Countdown)

    Hello
    Im a newbie when it comes to working with Javascript and Adobe Edge and need a bit of help with adjusting some javascript code to work with Adobe Edge. A friend of mine helped me with making this javascript code: Edit fiddle - JSFiddle
    Its a simple countdown which counts down to a certain time at a certain date. What I aim to do is to add this code as a trigger on a text-element called "countdown" (within a symbol called "count").
    I have tried to do this as the code is, but it does not work. Anyone have any suggestions?
    Thanks!
    Mvh,
    Øyvind Hermans

    Hello again
    I have stumbled upon a problem with these animations; They crash the browser after viewing them a little while, usually less than 30 seconds in.
    Is this problem also occuring when you watch the animations?
    Is the countdown-code to much for the browsers to handle?
    Thanks in advance for your answers.
    Sincerely,
    Øyvind Hermans

  • Help with HTML form code

    I need help on some HTML code if at all possible.
    What I am trying to do is set up a page that someone can
    enter their name address and email into a form and when they hit
    the submit button it automatically sends them a premade email of my
    choosing that I make prior and somehow maybe embeded into the html
    code to the address that they entered? I dont know if it is
    possible but I am sure it can be.
    Thank you in advance

    Actually, you could be subject to "abuse complaints", not
    "abuse".
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "bregent" <[email protected]> wrote in
    message
    news:fb547q$b49$[email protected]..
    > >What I am trying to do is set up a page that someone
    can enter their name
    > address
    >
    > Sure, you can do it fairly easily with any scripting
    language. You need to
    > be
    > cautious about sending automated emails to anyone
    without first validating
    > that
    > they are the actual owners of the email address,
    otherwise you open your
    > site
    > up to abuse.
    >
    > >I dont know if it is possible but I am sure it can
    be.
    >
    > Huh?
    >

  • Need Help With Simple ABAP Code

    Hello,
    I'm loading data from a DSO (ZDTBMAJ) to an Infocube (ZCBRAD06). I need help with ABAP code to some of the logic in Start Routine. DSO has 2 fields: ZOCTDLINX & ZOCBRDMAJ.
    1. Need to populate ZOCPRODCD & ZOCREFNUM fields in Infocube:
        Logic:-
        Lookup /BI0/PMATERIAL, if /BIC/ZOCBRDMAJ = /BIC/OIZOCBRDMAJ
        then /BIC/ZOCPRODCD = ZOCPRODCD in Infocube
               /BIC/ZOCREFNUM = ZOCREFNUM in Infocube         
    2. Need to populate 0G_CWWTER field in Infocube:
        Logic:
        Lookup /BIC/PZOCTDLINX, if /BIC/ZOCTDLINX = BIC/OIZOCTDLINX
        then G_CWWTER = 0G_CWWTER in Infocube.
    I would need to read single row at a time.
    Thanks!

    I resolved it.

Maybe you are looking for

  • Can't boot to safe mode or recovery

    Hi I was watching a video in Quicktime, with a few other videos paused and some pictures open in the background. I got a facetime call, so I paused the video and took the call. After hanging up, I maximised the video and attempted to play. My machine

  • ITunes does not display my feed image as defined in the itunes:image tag

    I set up a feed using a custom PHP script I wrote. This script creates an rss file that I will submit to apple once I have everything ironed out. right now the only thing left to fix is the missing feed image. I checked the xml and for the image I ha

  • Iphoto update

    Hi I'm not sure why but my computer says it will not accept the new iPhoto update....why is this? Also, I burned a disc of cd's from my friend who had the iphoto update and tried to then upload these into my computer but it said I couldn't becuase I

  • Getting an MBean implementation to self register

    Have a number for Jetty server/servlet combos each running in their own JVM that I want to register with a MBeanServer running in still another JVM. So I took client code to do this. The server class looks lik this: package com.sra.pipeline.servers.h

  • Behaviors vs Spry Widgets

    What's the difference between them? Ok, I know that spry widges require a separate file whereas behaviors don't. But I'm not interesting in the difference in code (css, javascript, etc.). I want to know what's the difference between the "effects" of