[New] Help with a VERY simple asterisk program.

Alright...I feel like a complete idiot asking this question..but I'm having such trouble writing this program. The program description is here:
Write a Java application using two for loops to produce the following pattern of asterisks.
I guess I'm really bad at algorithms yeah? Haha...well, any help would be very much appreciated.

Hi,
I don't think you don't need to look through any C programming books.
When you have a problem like this, do some thinking about what methods you need to use and what the general structure of the program will be.
You need to print asterisks out to the screen... so you'll need:
System.out.println
System.out.printAnd you already know that you need two loops.
Now you can ask yourself how you might use the print statements with two loops in order to design a basic structure for the program.
You have 8 lines, so you might want a loop that runs through 8 times, one of the lines printed each time.
Within this loop, you need another loop that prints out *'s. This loop could run once for each asterisk, but because there is a different number of asterisks on each line, the number of times this loop runs would be variable.
So a basic structure:
//loop1 that runs 8 times
    //loop2 that runs once for each *
        print one star
    //end loop2
//end loop1The key now is to recognise the difference between print and println. I don't know if you alread know, but System.out.print will print a string without creating a new line at the end, and println will create a new line at the end of the printed string.
Hope that helps. If you have any other problems, post specific questions along with the code you've written and are having trouble with.

Similar Messages

  • Help with a very simple horizontal Spry menu

    Hi,
    I’ve always received great help here and I’m sure that if I explain the issue I’m having properly I’ll get some good input.
    This is to do with a very simple horizontal Spry menu, there’s no dropdown involved, only a color change on the rollover.  The menu items are in a shade of blue, then on the rollover each menu item changes to a shade of red, the font color remains white for both.
    What’s mentioned above works flawlessly, the problem I’m having is this … On the rollover when the menu block items turn red, I’m attempting to add a 1px border around the entire block, but when I do the block item seems to want to change its width and height slightly when it’s rolled-over.  As I said, without the border it works perfect.
    Any suggestions will be appreciated.

    steve0308 wrote:
    Hi,
    I’ve always received great help here and I’m sure that if I explain the issue I’m having properly I’ll get some good input.
    This is to do with a very simple horizontal Spry menu, there’s no dropdown involved, only a color change on the rollover.  The menu items are in a shade of blue, then on the rollover each menu item changes to a shade of red, the font color remains white for both.
    What’s mentioned above works flawlessly, the problem I’m having is this … On the rollover when the menu block items turn red, I’m attempting to add a 1px border around the entire block, but when I do the block item seems to want to change its width and height slightly when it’s rolled-over.  As I said, without the border it works perfect.
    Any suggestions will be appreciated.
    You also have to apply the border to the 'a' css selector. If you just apply it to the 'a:hover' css selector then the tab will grow slightly bigger because its adding more width and height to the overall structure.

  • Need help with something VERY SIMPLE

    I'm brand new to Motion - as if today - but I'm only trying to do some VERY simple motions with photos - a simultaneous zoom in and reposition. What I've been doing is setting the starting key frame at one position (adjusting the x, y) and setting the scale. Then I create a second key frame and adjust the postion and scale. It will do the zoom, but then it re adjusts the starting position. If I readjust the starting key frame, it automatically readjusts the second key frame. I don't get it! Applying the various 'behaviors' doesn't seen to help. Certainly there's something obvious here that I'm missing - as I was able to do this in FCP. For some reason the key frames are not fixed when it comes to position.

    hi,
    a couple of thoughts?
    did you actually set a keyframe for position at the first frame?
    Also unless you are parked right on a keyframe or have the record button on, if you adjust a value, all the values for all keyframes adjust accordingly. I often mess something up because I wasnt parked on a keyframe.
    hth
    adam

  • Need help with a very simple example.  Trying to reference a value

    Im very new to Sql Load and have created this very simple example of what I need to do.
    I just want to reference the ID column from one table to be inserted into another table as DEV_ID.
    Below are my: 1) Control File, 2) Datafile, 3) Table Description, 4) Table Description
    1) CONTROL FILE:
    LOAD DATA
    INFILE 'test.dat'
    APPEND
    INTO TABLE p_ports
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    DEV_id REF(CONSTANT 'P_DEVICES',NAME),
    NAME FILLER ,
    PORT_NO
    2) DATAFILE:
    COMM881-0326ES09,6
    3) TABLE DESCRIPTION:
    SQL> describe p_ports
    Name Null? Type
    ID NOT NULL NUMBER(10)
    DEV_ID NOT NULL NUMBER(10)
    PORT_NO     NUMBER(3)

    hi,
    i managed to do this for my app. (think i referred to viewTransitions sample code and modified quite a bit)
    i can't remember this well cos i did this quite a while back, but i will try to help as much as possible
    1) from the appdelegate i initialize a root controller (view controller class)
    2) this root controller actually contains two other view controllers, let's call it viewAController and viewBController, for the screens which u are going to toggle in between. and there's also a function, let's call it toggleMenu, which will set the menus to and fro. i copied this whole chunk from the sample code. it actually defines the code on what to do, i.e. if current view is A switch to B and vice versa.
    3) inside the controller files, you need to implement the toggleMenu function too, which basically calls the rootController's toggleMenu
    4) we also need viewA and viewB files(view class)
    5) need to add the .xib files for the respective views and link them up to the controller class. i did not use the .xib files for ui layout though, because of my app's needs. however, it will not work properly without the .xib files.
    5) inside the view class of both views, i.e. viewA.m and viewB.m, you need to create a button, that will call the toggleMenu function inside the respective controller class.
    it will look something like this:
    [Button addTarget:ViewAController action:@selector(toggleMenu:) forControlEvents:UIControlEventTouchUpInside];
    so the flow is really button (in view)-> toggleMenu(viewController) -> toggleMenu(rootController)
    i'm sorry it sounds pretty hazy, i did this part weeks before and can't really remember. i hope it helps.

  • Need Help with a very simple view transition scenario

    Hello All,
    I am trying to learn how view transitions work and I am having a very hard time with the sample apps (like transition view app etc)...I need something much more simple at first. Can you please provide me a little guidelines on how to set up this following scenario:
    App loads up and shows a title screen with a button that says go. When you click on the go button the title screen fades out and a new view fades in (or slides in, or anything at all).
    Right now I have 3 nib files. There is the main one that is called on application start (tied with MainViewController, a subclass of IUViewcontroller just like in the hello world app. After the app loads the app delegate object tells the MainViewController object to load in another view controller object (via addSubview) which is tied with the second nib file; my title screen with the button. When I press the button I was thinking in the IBAction function to tell the MainViewController object to remove (or transition out somehow) the title screen view controller object then add the other view (third nib file in). This is the part I can't get working. Am I on the right track or have a gone hideously astray? Thank you!

    hi,
    i managed to do this for my app. (think i referred to viewTransitions sample code and modified quite a bit)
    i can't remember this well cos i did this quite a while back, but i will try to help as much as possible
    1) from the appdelegate i initialize a root controller (view controller class)
    2) this root controller actually contains two other view controllers, let's call it viewAController and viewBController, for the screens which u are going to toggle in between. and there's also a function, let's call it toggleMenu, which will set the menus to and fro. i copied this whole chunk from the sample code. it actually defines the code on what to do, i.e. if current view is A switch to B and vice versa.
    3) inside the controller files, you need to implement the toggleMenu function too, which basically calls the rootController's toggleMenu
    4) we also need viewA and viewB files(view class)
    5) need to add the .xib files for the respective views and link them up to the controller class. i did not use the .xib files for ui layout though, because of my app's needs. however, it will not work properly without the .xib files.
    5) inside the view class of both views, i.e. viewA.m and viewB.m, you need to create a button, that will call the toggleMenu function inside the respective controller class.
    it will look something like this:
    [Button addTarget:ViewAController action:@selector(toggleMenu:) forControlEvents:UIControlEventTouchUpInside];
    so the flow is really button (in view)-> toggleMenu(viewController) -> toggleMenu(rootController)
    i'm sorry it sounds pretty hazy, i did this part weeks before and can't really remember. i hope it helps.

  • Help with Forte: very simple question, please help!

    I recently downloaded the community version of Forte (Sun One) but can't seem to get any new empty class programs to execute properly. I know something is probably not set up right, which is why I really need a little help to get started. Regardless of the code I try to execute, the output error is always:
    "java.lang.NoClassDefFoundError: (name of program)
    Exception in thread "main" "
    Please let me know what I'm not doing right. I would really appreciate anybody's thoughts on this problem because I would love to get Forte working so I can start learning Java. Thanks for your input!

    I would tell you that Forte is not a tool for the beginner. you should look at something simpler. Forte is a fully integrated development environment. I would look at a simple editor like emacs, available at gnu.org. The commands of this editor are quite difficult to get use to.
    As for setting the class varialbe. It depends on the O/s that you are using. win98/me is different than NT/xp. Need to know one or the other before explaining.
    email me if you have question. email address is in my profile.

  • Help with a VERY simple Automator script

    i spent a few minuted trying to figure this out, but concluded it might be easier to simply ask in the forum how to do this.
    I want to
    1) open a terminal window
    2) execute the following commands:
    cd /Users/lenny/ventrilo/
    lenny$ /Users/lenny/ventrilo/ventrilo_srv
    thats it...
    please help using very small works
    ideally i would like this to be execute when i start up my computer. (i.e. a login script)

    If you need the Terminal window to stay open, then you're looking at scripting Terminal. You can do this with Automator's run applescript action, or you can just use Script Editor (in Applications > AppleScript). Either way you will need to save the workflow/script as an application and drag it to your Login Items (in System Preferences > Accounts).
    click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">tell application "Terminal"
    activate
    set commands to "cd /Users/lenny/ventrilo/ 
    /Users/lenny/ventrilo/ventrilo_srv"
    do script commands in front window
    end tell</pre>
    PowerMac G5 (June 2004) 2x1.8GHz 1.25GB, PowerBook G4 (12-inch DVI) 1x1GHz 768MB   Mac OS X (10.4.3)  

  • Need help getting a very simple RMI program running

    I've been pulling my hair out trying to get RMI running on windows. I decided to do a verbatim copy of a tutorial to see if it would work, well it didn't. Here is the sample code:
    //HelloInterface.java - located in dir c:\java
    import java.rmi.*;
    public interface HelloInterface extends Remote {
    public String say() throws RemoteException;
    //Hello.java - located in c:\java
    import java.rmi.*;
    import java.rmi.server.*;
    public class Hello extends UnicastRemoteObject implements HelloInterface {
    private String message;
    public Hello (String msg) throws RemoteException {
    message = msg;
    public String say() throws RemoteException {
    return message;
    //HelloServer.java - located in c:\java
    import java.rmi.*;
    import java.rmi.Naming;
    public class HelloServer{
    public static void main (String[] argv) {
    try {
    Naming.rebind ("Hello", new Hello ("Hello, world!"));
    System.out.println ("Hello Server is ready.");
    } catch (Exception e) {
    System.out.println ("Hello Server failed: " + e);
    Then I open a command prompt and go to c:\java and type:
    C:\java>javac HelloInterface.java
    C:\java>javac Hello.java
    C:\java>rmic Hello
    C:\java>javac HelloServer.java
    I then open a second command prompt and navigate to c:\registry to (to avoid being in the same directory as the stub files) and type:
    C:\register>C:\j2sdk1.4.2_03\bin\rmiregistry
    In the original command prompt, I then run HelloServer. I've tried running it a 100 different ways and always get the same error:
    Hello Server failed: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: Hello_Stub
    I've tried just running it as:
    java HelloServer
    java -classpath . HelloServer
    C:\java>java -Djava.rmi.server.codebase=http://localhost -classpath . HelloServer
    C:\java>java -Djava.security.policy=..\policy.all -Djava.rmi.server.codebase=http://localhost -classpath . HelloServer
    Where policy.all is:
    grant {
         permission java.security.AllPermission;
    And pretty much just about every combination of the above that you can think of.

    //HelloInterface.java - located in dir c:\java
    import java.rmi.*;
    public interface HelloInterface extends Remote {
      public String say() throws RemoteException;
    }//Hello.java - located in c:\java
    import java.rmi.*;
    import java.rmi.server.*;
    public class Hello extends UnicastRemoteObject implements HelloInterface {
      private String message;
      public Hello (String msg) throws RemoteException {
        message = msg;
      public String say() throws RemoteException {
        return message;
    }//HelloServer.java - located in c:\java
    import java.rmi.*;
    import java.rmi.Naming;
    public class HelloServer{
      public static void main (String[] argv) {
        try {
          Naming.rebind ("Hello", new Hello ("Hello, world!"));
          System.out.println ("Hello Server is ready.");
        } catch (Exception e) {
          System.out.println ("Hello Server failed: " + e);
    }I'm not sure what you are saying about the CLASSPATH. I thought rmiregistry had to be ran in a different directory than the stub files and that the stubs shouldn't be in the CLASSPATH of the terminal launching rmiregistry.
    The HelloServer is being ran with the -classpath option set to "." and the stubs are in the same directory.

  • Help with a very simple password field

    The following question can be observed, and manipulated with
    the following:
    Source:
    http://www.ucsdkya.com/kyaonly.fla
    SWF:
    http://www.ucsdkya.com/kyaonly.swf
    I am using embedded fonts for this flash file, and it seems
    that no matter what, it converts my text field to an HTML one. The
    trace feature made it quite obvious! What can I do to remedy this,
    while keeping it the same looking the same. Is there a cheap
    workaround? Thanks!

    Well, it hit me almost a few seconds after (go figure) that I
    could just copy and past the entire trace message as the required
    string for entry. Easy solution.

  • Hoping for some help with a very frustrating issue!   I have been syncing my iPhone 5s and Outlook 2007 calendar and contacts with iCloud on my PC running Vista. All was well until the events I entered on the phone were showing up in Outlook, but not

    Hoping for some help with a very frustrating issue!
    I have been syncing calendar and contacts on my iPhone 5 and Outlook 2007 using iCloud  2.1.3 (my PC is running Vista). All was well until the events I entered on the phone were showing up in Outlook, but not the other way around. I’ve tried the usual recommended steps: deselecting calendar and contacts in the iCloud control panel and then re-selecting, signing out of the panel and back in, and repairing the Outlook installation in control panel.  I even uninstalled iCloud on the PC and downloaded it again (same version). 
    The furthest I’ve gotten is step 2 (and once, step 3) of 7 while performing “Outlook Setup For iCloud.” At that point I get, “Your setup couldn’t be started because of an unexpected error.”  After the first attempt at all this, all my calendar events disappeared from Outlook, although they are still in iCloud calendar and on my phone.
    Sound familiar?  Any ideas on how to solve this iCloud/Outlook issue?  Thanks much in advance!

    Hoping for some help with a very frustrating issue!
    I have been syncing calendar and contacts on my iPhone 5 and Outlook 2007 using iCloud  2.1.3 (my PC is running Vista). All was well until the events I entered on the phone were showing up in Outlook, but not the other way around. I’ve tried the usual recommended steps: deselecting calendar and contacts in the iCloud control panel and then re-selecting, signing out of the panel and back in, and repairing the Outlook installation in control panel.  I even uninstalled iCloud on the PC and downloaded it again (same version). 
    The furthest I’ve gotten is step 2 (and once, step 3) of 7 while performing “Outlook Setup For iCloud.” At that point I get, “Your setup couldn’t be started because of an unexpected error.”  After the first attempt at all this, all my calendar events disappeared from Outlook, although they are still in iCloud calendar and on my phone.
    Sound familiar?  Any ideas on how to solve this iCloud/Outlook issue?  Thanks much in advance!

  • TS2446 Hello, I'm Bethany and I'm having trouble with my apple ID I tried to buy something from he app store and they assed me some questions and anyway i have locked my account and don't know how to unlock any help with be very helpful thanks.

    Hello, I'm Bethany and I'm having trouble with my apple ID I tried to buy something from he app store and they assed me some questions and anyway i have locked my account and don't know how to unlock any help with be very helpful thanks.

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • New help with my mac air and airport extreme time capsule dont know how to save to time capsule and use as a external hd

    new help with my mac air and airport extreme time capsule dont know how to save to time capsule and use as a external hd would like 2 store my home videos and pictures on the time machine (ONLY) as the MAC AIR has storage space limited space please help. THANK YOU.

    See the info here about sharing or using the TC for data.
    Q3 http://pondini.org/TM/Time_Capsule.html
    It is extremely important you realise.. the Time Capsule was never designed for this.
    It is a backup target for Time Machine.. that is the software on the computer that does backups.. it has no direct connection to the Time Capsule.
    It has no ability to back itself up.. unlike all other NAS in the market. It is therefore likely one day you will lose all your files unless you seriously work out how to backup.
    The TC is slow to spin up the hard disk and fast to spin down. iTunes and iPhoto will continually lose connection to their respective libraries.
    iPhoto in particular is easy to corrupt when you move photos over wireless into the library.. once corrupted all is corrupt. A single photo will ruin it all.. so backup is utterly essential.
    Time Machine cannot do backups of network drives. ie the TC. You will need a different backup software like CCC. You will then need another target to backup to..

  • First Very Simple Socket Program

    Hello,
    I am learning about Sockets and ServerSockets and how I can use the. I am trying to make the simplest server/client program possible just for my understanding before I go deper into it. I have written two programs. theserver.java and theclient.java the sere code looks like this....
    import java.net.*;
    import java.io.*;
    import java.util.*;
    public class theserver
      public static void main(String[] args)
      {   //  IOReader r = new IOReader();
            int prt = 3333;
            BufferedReader in;
             PrintWriter out;
            ServerSocket serverSocket;
            Socket clientSocket = null;
    try{
    serverSocket = new ServerSocket(prt);  // creates the socket looking on prt (3333)
    System.out.println("The Server is now running...");
    while(true)
        clientSocket = serverSocket.accept(); // accepts the connenction
        clientSocket.getKeepAlive(); // keeps the connection alive
        out = new PrintWriter(clientSocket.getOutputStream(),true);
        in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
         if(in.ready())
         System.out.println(in.readLine()); // print it
    catch (IOException e) {
        System.out.println("Accept failed:"+prt);
    }and the client looks like this
    import java.net.*;
    import java.io.*;
    public class theclient
    public static void main(String[] args)
        BufferedReader in;
        PrintWriter out;
        IOReader r = new IOReader();
        PrintWriter sender;
        Socket sock;
      try{
        sock = new Socket("linuxcomp",3333);  // creates a new connection with the server.
        sock.setKeepAlive(true); // keeps the connection alive
        System.out.println("Socket is connected"); // confirms socket is connected.
        System.out.println("Please enter a String");
         String bob = r.readS();
          out = new PrintWriter(sock.getOutputStream(),true);
        out.print(bob); // write bob to the server
      catch(IOException e)
           System.out.println("The socket is now disconnected..");
    }If you notice in the code I use a class I made called IOReader. All that class is, is a buffered reader for my System.in. (just makes it easier for me)
    Ok now for my question:
    When I run this program I run the server first then the client. I type "hello" into my system.in but on my server side, it prints "null" I can't figure out what I am doing wrong, if I am not converting correctly, or if the message is not ever being sent. I tried putting a while(in.read()) { System.out.println("whatever") } it never reaches a point where in.ready() == true. Kinda of agrivating. Because I am very new to sockets, I wanna aks if there is somthing wrong with my code, or if I am going about this process completely wrong. Thank you to how ever helps me,
    Cobbweb

    An example of Creating a Client Socket (Java socket programming tutorial)
    try {
            InetAddress addr = InetAddress.getByName("hotdir.biz");
            int port = 80;
            // This constructor will block until the connection succeeds
            Socket socket = new Socket(addr, port);
        } catch (UnknownHostException e) {
        } catch (IOException e) {
        // Create a socket with a timeout
        try {
            InetAddress addr = InetAddress.getByName("hotdir.biz");
            int port = 80;
            SocketAddress sockaddr = new InetSocketAddress(addr, port);
            // Create an unbound socket
            Socket sock = new Socket();
            // This method will block no more than timeoutMs.
            // If the timeout occurs, SocketTimeoutException is thrown.
            int timeoutMs = 2000;   // 2 seconds
            sock.connect(sockaddr, timeoutMs);
        } catch (UnknownHostException e) {
        } catch (SocketTimeoutException e) {
        } catch (IOException e) {
        }See socket tutorial here http://www.developerzone.biz/index.php?option=com_content&task=view&id=94&Itemid=36

  • Help with a very basic GUI

    Hi guys, i have a project to do and Ive chosen hangman. Ive already made the main program , but i need help with the GUI. I havent been taught about GUI in school, so all i know is what i could understand from a book and what ive read on the internet..
    First , heres the code of my basic Hangman class:
    import java.io.*;
    import java.util.Random;
    public class Hangman
        public void maingame()throws IOException
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String movies[]={"THE BOURNE ULTIMATUM","TRANSFORMERS","RUSH HOUR 3","THE INSIDE MAN","THE SIMPSONS MOVIE","THE LORD OF THE RINGS","DIE HARD 4.0"};
            Random rand = new Random();
            char current[]=(movies[rand.nextInt(movies.length)]).toCharArray();  //Convert a random string from movies array into a char array
            char actual[]=new char[current.length]; //Store current state of guessed movie
            for (int i=0;i<actual.length;i++)
                if (isVowel(Character.toUpperCase(current))==true)
    actual[i]=current[i];
    else if (isSpecialChar(Character.toUpperCase(current[i]))==true)
    actual[i]=current[i];
    else if (current[i]==' ')
    actual[i]='/';
    else
    actual[i]='_';
    String hangman = "HANGMAN";
    int turnsleft=7;
    StringBuffer guessed=new StringBuffer();
    while (turnsleft!=0)
    System.out.println("\n\t\t\t\t"+hangman.substring(0,turnsleft)+"\n");
    print(actual);
    System.out.println("\nEnter your guess");
    String inp = br.readLine();
    if (inp.length()>1)
    System.out.println("You may only enter one character");
    else
    char guess = inp.charAt(0); //Convert the entered string to char
    if ( (hasBeenGuessed(guess,guessed)) == true )
    System.out.println("You have already guessed that\nYou have "+turnsleft+" turns left");
    else if (guess >= '0' && guess <= '9')
    System.out.println("You cannot guess digits.All digits in a movie will will be filled in automatically");
    else
    guessed.append(guess);
    if (isVowel(guess)!=true)
    if (isCorrect(guess,turnsleft,current,actual)==true)
    if (hasWon(actual,current)==true)
    System.out.println();
    print(actual);
    System.out.println("\nCongratulations!You won!");
    System.exit(0);
    else
    System.out.println("\nCorrect Guess!\nYou have "+turnsleft+" turns left\n");
    else
    turnsleft--;
    System.out.println("Wrong Guess!\nYou have "+turnsleft+" turns left\n");
    else if (isVowel(guess)==true)
    System.out.println("You cannot guess vowels\nYou have "+turnsleft+" turns left\n");
    else
    System.out.println("You have already guessed that\nYou have "+turnsleft+" turns left\n");
    print(actual);
    if (turnsleft==0)
    System.out.println("\nYou lose!\nThe movie was: ");
    print(current);
    System.exit(0);
    private boolean isCorrect(char guess,int turnsleft,char current[],char actual[])
    int flag=0;
    for (int i=0;i<current.length;i++)
    if ( Character.toUpperCase(current[i])==Character.toUpperCase(guess) && actual[i]!=guess ) //Check if guess is correct, and make sure it has not already been entered
    actual[i]=guess;
    flag=1;
    else if (Character.toUpperCase(current[i])!=Character.toUpperCase(guess) && i==current.length-1 && flag==0)
    return false;
    if (flag!=0)
    return true;
    else
    return false;
    private boolean hasWon(char actual[],char current[])
    char actualspc[]=new char[actual.length];
    for (int i=0;i<actual.length;i++)
    if (actual[i]=='/')
    actualspc[i]=' ';
    else
    actualspc[i]=actual[i];
    for (int i=0;i<actual.length;i++)
    if ((Character.toUpperCase(current[i]))==(Character.toUpperCase(actualspc[i])) && i==actual.length-1)
    return true;
    else if ((Character.toUpperCase(current[i]))==(Character.toUpperCase(actualspc[i])) && i!=actual.length-1)
    continue;
    else
    return false;
    return false;
    private void print(char arr[])
    for (int i=0;i<arr.length;i++)
    System.out.print(Character.toUpperCase(arr[i])+" ");
    private boolean isVowel(char a)
    if (a=='a' || a=='A' || a=='e' || a=='E' || a=='i' || a=='I' || a=='o' || a=='O' || a=='u' || a=='U')
    return true;
    else
    return false;
    private boolean isSpecialChar(char a)
    //if (a>='a' && a<='z')
    //return false;
    //else if (a>='A' && a<='z')
    //return false;
    //else if (a==' ')
    //return false;
    //else if (a>='0' && a<='9')
    //return true;
    if (isLetter(a)==true)
    return false;
    else if (isWhiteSpace(a)==true)
    return false;
    else if (isDigit(a)==true)
    return true;
    else
    return true;
    private boolean hasBeenGuessed(char a,StringBuffer guessed)
    for (int i=0;i<guessed.length();i++)
    if ( Character.toUpperCase(guessed.charAt(i)) == Character.toUpperCase(a))
    return true;
    return false;
    My first 2 questions are here:
    a - Why does isLetter not work, it says cannot resolve symbol - method isLetter(char)... Im guessing even isDigit and isWhiteSpace wont work, so why? If i cant use them ill have to use the commented code, its kind of unprofessional..
    b- Isnt there any way i can compare chars ignoring cases besides converting both to one case, like im doing now?
    Heres the new HangmanGUI class i made, it doesnt necessarily have to be a different class in the final outcome, but i would prefer it if it can.. Ive made what i can figure out.. Ive commented about what i need to do.
    Keep in mind i cant use Applets, only Frame/JFrame
    import java.awt.*;
    import javax.swing.*;
    public class HangmanGUI extends JFrame implements ActionListener
        Button newGame = new Button("New Game");
        Button entGuess = new Button("Submit Guess");
        Button giveUp = new Button("Give Up");
        TextField input = new TextField("",1);
        Label hangman = new Label("HANGMAN");
        JPanel play = new JPanel();
        JPanel hang = new Jpanel();
        GridLayout playLayout = new GridLayout(2,4);
        public HangmanGUI()
            play.setLayout(playLayout);
            play.add(hangman+"\n");
            play.add(newGame);
            play.add(giveUp);
            play.add(input);
            play.add(entGuess);
            hang.add(hangman);
            getContentPane().add(play);
            getContentPane().add(hang);
        public void ActionPerformed(ActionEvent act)
            Object src = act.getSource();
            if (src==newGame)
            main(); //Calling main to restart program - will that work?
            //if (src==entGuess)
            //Need to submit the guess, while input is not empty to Hangman class
            //if (src==giveUp)
            //Need to go into the losing part of Hangman class
    }As you can see i need help with:
    a - How to complete the other ifs
    b - How to really use the data of my Hangman class in this class and combine the GUI and backend to make a nice GUI Hangman app
    c - btw, right now if i try to compile HangmanGUI it highlights the implements ActionListener line and says cannot resolve symbol - class ActionListener..
    Any help would be greatly appreciated

    Thanks for the explanation pete...
    Anyways, i started implementing my code within abillconsl's code, and im trying to assign a label to a char array using .toString(); but instead of whats in the char array i get [C@<numbers and digits> ..
    Whats wrong?
    [code]
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.Random;
    public class HangEmHighGUI extends JFrame implements ActionListener
    private Button newGame,
    entGuess,
    giveUp;
    private TextField input;
    private Label hangman,
    movie;
    private JPanel play,
    hang;
    private GridLayout playLayout;
    private FlowLayout labelLayout;
    private Container container; // To avoid extra meth calls
    String movies[]={"THE/BOURNE/ULTIMATUM","TRANSFORMERS","RUSH HOUR 3","THE INSIDE MAN","THE SIMPSONS MOVIE","THE LORD OF THE RINGS","DIE HARD 4.0"};
    Random rand = new Random();
    char current[]=(movies[rand.nextInt(movies.length)]).toCharArray(); //Convert a random string from movies array into a char array
    char actual[]=new char[current.length]; //Store current state of guessed movie
    public HangEmHighGUI()
    setUp();
    container = this.getContentPane();
    play = new JPanel();
    hang = new JPanel();
    playLayout = new GridLayout(1, 3, 5, 5); // rows, cols, space, space
    labelLayout = new FlowLayout(FlowLayout.CENTER);
    newGame = new Button("New Game");
    entGuess = new Button("Submit Guess");
    giveUp = new Button("Give Up");
    input = new TextField("",1);
    hangman = new Label("HANGMAN");
    movie = new Label(actual.toString());
    hang.setLayout(labelLayout);
    play.setLayout(playLayout);
    play.add(newGame);
    play.add(giveUp);
    play.add(entGuess);
    hang.add(hangman);
    hang.add(movie);
    container.add(hang,BorderLayout.NORTH);
    container.add(input,BorderLayout.CENTER);
    container.add(play,BorderLayout.SOUTH);
    pack();
    setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    public void actionPerformed(ActionEvent act)
    Object src = act.getSource();
    if (src==newGame)
    main(new String[] {""}); //Calling main to restart program, this does not work without parameters, is there some other way to restart?
    if (src==entGuess)
    if (input.getText()=="")
    setUp();
    //if (src==giveUp)
    //Need to go into the losing part of Hangman class
    public static void main(String args[])
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    new HangEmHighGUI();
    private void setUp()
    for (int i=0;i<actual.length;i++)
    if (isVowel(Character.toUpperCase(current)))
    actual[i]=current[i];
    else if (isSpecialChar(Character.toUpperCase(current[i])))
    actual[i]=current[i];
    else if (Character.isWhitespace(current[i]))
    actual[i]='/';
    else
    actual[i]='_';
    private boolean isVowel(char a)
    if (Character.toUpperCase(a)=='A' || Character.toUpperCase(a)=='E' || Character.toUpperCase(a)=='I' || Character.toUpperCase(a)=='O' || Character.toUpperCase(a)=='U')
    return true;
    else
    return false;
    private boolean isSpecialChar(char a)
    if (Character.isLetter(a))
    return false;
    else if (Character.isDigit(a))
    return true;
    else if (Character.isWhitespace(a))
    return false;
    else
    return true;
    private boolean isCorrect(char guess,int turnsleft,char current[],char actual[])
    int flag=0;
    for (int i=0;i<current.length;i++)
    if ( Character.toUpperCase(current[i])==Character.toUpperCase(guess) && actual[i]!=guess ) //Check if guess is correct, and make sure it has not already been entered
    actual[i]=guess;
    flag=1;
    else if (Character.toUpperCase(current[i])!=Character.toUpperCase(guess) && i==current.length-1 && flag==0)
    return false;
    if (flag!=0)
    return true;
    else
    return false;
    private boolean hasWon(char actual[],char current[])
    char actualspc[]=new char[actual.length];
    for (int i=0;i<actual.length;i++)
    if (actual[i]=='/')
    actualspc[i]=' ';
    else
    actualspc[i]=actual[i];
    for (int i=0;i<actual.length;i++)
    if ((Character.toUpperCase(current[i]))==(Character.toUpperCase(actualspc[i])) && i==actual.length-1)
    return true;
    else if ((Character.toUpperCase(current[i]))==(Character.toUpperCase(actualspc[i])) && i!=actual.length-1)
    continue;
    else
    return false;
    return false;
    private void print(char arr[])
    for (int i=0;i<arr.length;i++)
    System.out.print(Character.toUpperCase(arr[i])+" ");
    private boolean hasBeenGuessed(char a,StringBuffer guessed)
    for (int i=0;i<guessed.length();i++)
    if ( Character.toUpperCase(guessed.charAt(i)) == Character.toUpperCase(a))
    return true;
    return false;
    Note that the majority of the code has been taken from my old hangman class, i havent adapted it to the GUI yet, so ignore all of that stuff.

  • XSL for a Pie chart with a very simple XML data file

    Hi All
    Using BI Pub Desktop 10.1.3.2.1 with Oracle Apps R12.1.3.
    I am trying to do a pie chart for the below data in an xml file. Normally this is pretty straight forward but with the below simple data structure I am a bit stuck, maybe thinking about it too much. Appreciate any help on what the xsl should like.
    xml file contains only the below. There is no other data in the file.
    <G2>
    <ITEM>ALL</ITEM>
    <AA>10</AA>
    <BB>20</BB>
    <CC>50</CC>
    <DD>30</DD>
    </G2>
    I want to be able to have a pie chart that shows the labels: AA, BB, CC and DD with the corresponding data values of 10,20,50 and 30.
    Thanks for viewing the question.
    Cheers Cel

    Please disregard. i went back to the original blog code and started over, and figured this out.

Maybe you are looking for

  • Why do arrow keys stop working with type in CS6

    I searched this issue and found many forums discussing the topic, but no solution. When using PS CS6, the arrow keys randomly stop working when navigating around in text. This is extremely frustrating. Per other discussions, and my experience, there

  • Cue Point - navigateTourl question

    Ok, this is what I need to do, I have an flv inside an swf. when the flav gets to either 22:00 or a certain frame I need an invisible button to appear ONLY after the cue point where the flv will display a click here graphic and the invisible button w

  • No Such Entity error when persisting changes to web descriptor

    Hello. Has anyone else run into trouble editing a web descriptor via the Admin Console? When I attempt to save any changes I get the following error: ' No Such Entity. There is no longer a Web Descriptor named XYZ Runtime entity may have ceased to ex

  • JavaHelp Frustrating?

    Has anyone else found JavaHelp frustrating to use? I just spent half a day trying to figure out why images in the table of contents weren't displaying. I never did figure it out. My src paths are all absolute. I moved everything to a different folder

  • AddIns("Hyperion Essbase OLAP Server DLL (non-Unicode)").Installed = False

    I am using Hyperion Essbase 11.1.1.3 Version. Previously I was using Hyperion Essbase 9.3.1. I have used "AddIns("Hyperion Essbase OLAP Server DLL (non-Unicode)").Installed = False" for Essbase 9.3.1. Can anyone please let me know the similar VB code