It is not a graded question. It is a practice question from last year. I'm stuck please help!  Question You should be able to do this question after learning about how to display text and learning how to write a basic counting loop. Use a counting loop to draw the eight buttons on the top button bar. Create appropriate global constants to specify the width and height of the buttons as well as the number of buttons. This loop should draw buttons with no text labels on them. You can choose whatever fill colour you want for the buttons. Next, add the text labels [New…, Original, UPPER, lower, iNVERT, camelCase, CONSTANT] to the buttons, one at a time1. You can’t do this inside the loop because each label is unique. You can create functions to draw each button label if you want. All the labels should be vertically aligned and each label should be centered in each button. The buttons should follow the order shown. There is no label for the last button (that’s for the bonus). Finally, add code to the button loop to detect if the mouse is over the button you are currently drawing, and if so, use a different highlight colour to indicate this, as seen in the demo. All of the code for this should be in one or more functions, and only the main button bar drawing function should be called from your draw() function. At this point, your draw() function should only contain a background call and the function call to draw the button bar.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

It is not a graded question. It is a practice question from last year. I'm stuck please help! 

Question

You should be able to do this question after learning about how to display text and learning how
to write a basic counting loop.
Use a counting loop to draw the eight buttons on the top button bar. Create appropriate global
constants to specify the width and height of the buttons as well as the number of buttons. This
loop should draw buttons with no text labels on them. You can choose whatever fill colour you
want for the buttons.
Next, add the text labels [New…, Original, UPPER, lower, iNVERT, camelCase, CONSTANT]
to the buttons, one at a time1. You can’t do this inside the loop because each label is unique. You
can create functions to draw each button label if you want. All the labels should be vertically
aligned and each label should be centered in each button. The buttons should follow the order
shown. There is no label for the last button (that’s for the bonus).
Finally, add code to the button loop to detect if the mouse is over the button you are currently
drawing, and if so, use a different highlight colour to indicate this, as seen in the demo.
All of the code for this should be in one or more functions, and only the main button bar drawing
function should be called from your draw() function. At this point, your draw() function should
only contain a background call and the function call to draw the button bar.

Attached is the picture of my code currently.

Thanks

O sketch_211209a | Processing 3.5.4
O X
File Edit Sketch Debug Tools Help
Java v
You are screen sharing
I Stop Share
sketch_211209a
******/
9 import javax.swing.JOptionPane;
10
11 //Global Constants
12 int WIDTH= 100;
13 int HEIGHT= 50;
14 int NUMBER_OF_BUTTONS= 8;
15
16 //Global Variables
17 int index;
18
19 void setup () {
size (800, 400);
21 }
20
22
23 void draw () {
24 }
25
26 void drawButtonBar () {
27
boolean bo=mouseX<=100&&mouseX<;
int index=mouseX/100;
28
29
for (int i=0; i<NUMBER_OF_BUTTONS; i++) {
if (mouseY<=30&&bo) {
fill(20, 234, 200);
} else {
30
31
32
33
fill(20, 34, 200);
}
rect (WIDTH*i, 0, WIDTH, HEIGHT);
34
35
36
37
}
38
39
Error on "<" Consider adding "Expression"
>- Console
A Errors
4:05 PM
e Type here to search
-2°C Mostly sunny
12/9/2021
Transcribed Image Text:O sketch_211209a | Processing 3.5.4 O X File Edit Sketch Debug Tools Help Java v You are screen sharing I Stop Share sketch_211209a ******/ 9 import javax.swing.JOptionPane; 10 11 //Global Constants 12 int WIDTH= 100; 13 int HEIGHT= 50; 14 int NUMBER_OF_BUTTONS= 8; 15 16 //Global Variables 17 int index; 18 19 void setup () { size (800, 400); 21 } 20 22 23 void draw () { 24 } 25 26 void drawButtonBar () { 27 boolean bo=mouseX<=100&&mouseX<; int index=mouseX/100; 28 29 for (int i=0; i<NUMBER_OF_BUTTONS; i++) { if (mouseY<=30&&bo) { fill(20, 234, 200); } else { 30 31 32 33 fill(20, 34, 200); } rect (WIDTH*i, 0, WIDTH, HEIGHT); 34 35 36 37 } 38 39 Error on "<" Consider adding "Expression" >- Console A Errors 4:05 PM e Type here to search -2°C Mostly sunny 12/9/2021
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY