English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

My assignment: The
top-right cell requires horizontal lines that are equidistant in the cell. Each line is 10 pixels apart. Additionally, the lines need to be colored randomly in any possible red, green and blue range.

picture example: http://i68.photobucket.com/albums/i35/stxda/example.jpg

I did the top left cell, and my coding was:

----------------
import java.awt.*;
import java.applet.*;
import java.util.*;


public class Lab06G80 extends Applet
{

public void paint(Graphics g)
{
int width = 800;
int height = 600;
g.drawRect(10,10,width,height);
{
g.drawLine(410,10,410,610);
}
{
g.drawLine(10,310,810,310);
}

for (int a = 20; a <= 400; a += 10)
{
g.drawLine(a,20,a,290);
}

}

}
-------------------------

now I need help doing the top right cell.. please help coders!!

2007-01-27 10:30:34 · 2 answers · asked by Snaox 1 in Computers & Internet Programming & Design

2 answers

public static void main(String[] args) {
Random randomColour = new Random();
for (int a = 1; a <= 10; a += 1)
{
int x=randomColour.nextInt(20);
System.out.println(""+x+"");
if(x<6)
{System.out.println("green");}
//g.setColor(Color.green);
else if(x>=6 && x<=13 )
{System.out.println("red");}
//g.setColor(Color.red);
else
{System.out.println("blue");}
//g.setColor(Color.blue);
}
}
I suppose that your problems were more on the colour randomization, so maybe this coding here should help you out.

2007-01-27 18:43:12 · answer #1 · answered by Geinius 3 · 0 0

i imagine the percentis very warm... pay interest to the Non coms. they have executed some excursions & recognize a thanks to get with the help of. not in any respect take aspect & not in any respect stand nonetheless too lengthy in a unmarried spot(extra reachable to shoot you). Eyes open for wires or disturbed earth (IED/mines). Drink in user-friendly words sparkling water.

2016-12-03 03:11:30 · answer #2 · answered by ? 4 · 0 0

fedest.com, questions and answers