0
Answer

code completion ? some part finished ..

SUNIL GUTTA

SUNIL GUTTA

11y
963
1

Hieee guys


Q) Fill an input array of size 10 with random numbers in the range between 1 and 100

using the built-in subroutine random. Then ask the user to input a number. Output

the sum of numbers that are larger than the input number. Also, change the colour

of the numbers that are larger than this number, to red, only add code to areas specified in skeleton code


String lastInput = new String();
String currentInput = new String();
int num;// num is the number entered by the user
int[] array = new int[10];// input array
PFont myFont;
int hOffset, vOffset, vSpacing, hSpacing;
int sum;
// Declare variables that you may need in here.


void setup()
{
size(700, 200);
smooth();
myFont = createFont("FFScala", 32);
textFont(myFont);
textAlign(LEFT);
vSpacing = 50;// vertical spacing between text
hSpacing = 50;// horizontal spacing between numbers
// initialize the array below


}
void draw()
{
background(255);
fill(0);
sum = 0;// sum of numbers
hOffset = 50;// horizontal offset. The position to show the first character
vOffset = 50;// vertical offset.
// add code below


// add code above
}

// keyPressed is a subroutine to handle input
// The most important information
// that is needed is that the inputs are in the variables i and s.
// num is the number entered by the user
void keyPressed()
{
if (key == ENTER)
{
lastInput = currentInput;
num = int(currentInput);
currentInput = "";
}
else
{
lastInput = "";
currentInput = currentInput + key;
}
}


Cheers

Thank you