
-----------------------------------
nou nou
Thu Feb 11, 2010 9:09 pm

ez java program to start off
-----------------------------------
well here's the thing im quite new here and i need ur help as im a noob at java yet a master at turing :)

there is this program that requires me to output 4 filled colour squares at the absolute bottom of the java output page and each square must take a 1/4 of the page in order to fill the entire width of the page...

how would i go on attempting to do this..
oh also i have to use something like this void block ( int* xc, int* yc, howbig, Color.*clr)

* = not sure about
here's what i have yet

 
// The "Block" class.
import java.awt.*;
import hsa.Console;

public class Block
{
    static Console c;           // The output console

    public static void main (String[] args)
    {
        c = new Console ();
        int xc = c.getWidth () / 4; // Find the x corner
        int yc = c.getWidth () / 4;
    }


    void block (xc, yc, howbig, Color clr);

    drawRect (int x, int y, int howbig, Color.blue);
    // Place your program here.  'c' is the output console
    // main method
} // Block class


thx for ur help in advance

-----------------------------------
TerranceN
Thu Feb 11, 2010 9:47 pm

RE:ez java program to start off
-----------------------------------
You might want to read the [url=http://compsci.ca/v3/viewtopic.php?t=9576]Java tutorial, because it seems like you do not know how to use methods.

"void block ( int* xc, int* yc, howbig, Color.*clr)"

I have no idea why the *s are there, they will just give you syntax errors AFAIK, just exclude them.

-----------------------------------
facultyofmusic
Fri Mar 12, 2010 5:56 pm

Re: ez java program to start off
-----------------------------------
My friend just did something like this today.  I suggested him the book "Head First Java".  I used that book to start out java and it was a great help.  Consider going to the library sometime...

-----------------------------------
yoursecretninja
Thu Mar 18, 2010 11:06 am

Re: ez java program to start off
-----------------------------------
You are not far enough along for anyone to help you without actually doing the work for you. It looks like you are struggling with the whole concept of a class and the role of constructors and methods. Try reading this: http://www.javacoffeebreak.com/java102/java102.html

Also, I'll second the recommendation for Head First Java. Great first Java book.

-----------------------------------
Barbarrosa
Thu Mar 18, 2010 7:42 pm

Re: ez java program to start off
-----------------------------------
If it's not required for a class, I HIGHLY recommend avoiding use of the "Console" class, which is unique to a specific IDE (and not in Java itself). Use Swing and/or AWT for graphical output. You could make what you're suggesting pretty easily that way, and there are plenty of tutorials on Sun's website.

-----------------------------------
Tony
Thu Mar 18, 2010 9:46 pm

Re: ez java program to start off
-----------------------------------
and there are plenty of tutorials on Sun's website.
You mean Oracle's website, right? :lol:
