Below is my code.How can i fix thisimport java.awt.;pu.pdf

A

Below is my code. How can i fix this? import java.awt.*; public class IfGrid { public static void main(String[] args) { DrawingPanel panel = new DrawingPanel(400, 400); panel.setBackground(Color.blue); Graphics g = panel.getGraphics(); int sizeX = 40; int sizeY = 40; for (int x = 0; x < 10; x++) { for (int y = 0; y < 10; y++) { int cornerX = x*sizeX; int cornerY = y*sizeY; if ((x + y)%2==0 ); g.setColor(Color.green); else g.setColor(Color.yellow); g.fillRect(cornerX, cornerY, sizeX-1, sizeY-1); g.setColor(Color.black); g.drawString("x="+x, cornerX+10, cornerY+15); // text is positioned at its baseline g.drawString("y="+y, cornerX+10, cornerY+33); // offsets from the corner do centering } } } } Make a checkboard pattern. Hint look at the sum x+y for the green squares. Copy your modified if statement into your solutions document..

Below is my code.
How can i fix this?
import java.awt.*;
public class IfGrid {
public static void main(String[] args) {
DrawingPanel panel = new DrawingPanel(400, 400);
panel.setBackground(Color.blue);
Graphics g = panel.getGraphics();
int sizeX = 40;
int sizeY = 40;
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
int cornerX = x*sizeX;
int cornerY = y*sizeY;
if ((x + y)%2==0 );
g.setColor(Color.green);
else
g.setColor(Color.yellow);
g.fillRect(cornerX, cornerY, sizeX-1, sizeY-1);
g.setColor(Color.black);
g.drawString("x="+x, cornerX+10, cornerY+15); // text is positioned at its baseline
g.drawString("y="+y, cornerX+10, cornerY+33); // offsets from the corner do centering
}
}
}
}
Make a checkboard pattern. Hint look at the sum x+y for the green squares. Copy your modified
if statement into your solutions document.

Recomendados

No calculators are allowed. Fix the errors for question 2. Then draw.pdf von
No calculators are allowed. Fix the errors for question 2. Then draw.pdfNo calculators are allowed. Fix the errors for question 2. Then draw.pdf
No calculators are allowed. Fix the errors for question 2. Then draw.pdffreddysarabia1
2 views2 Folien
662305 10 von
662305 10662305 10
662305 10Nitigan Nakjuatong
305 views6 Folien
662305 LAB13 von
662305 LAB13662305 LAB13
662305 LAB13Nitigan Nakjuatong
331 views10 Folien
No3 von
No3No3
No3syahronirpl
143 views10 Folien
ch03g-graphics.ppt von
ch03g-graphics.pptch03g-graphics.ppt
ch03g-graphics.pptMahyuddin8
4 views24 Folien
bfd23fd7-0d89-45c0-8b82-c991b30ed375.pdf von
bfd23fd7-0d89-45c0-8b82-c991b30ed375.pdfbfd23fd7-0d89-45c0-8b82-c991b30ed375.pdf
bfd23fd7-0d89-45c0-8b82-c991b30ed375.pdfshehabhamad_90
1 view30 Folien

Más contenido relacionado

Similar a Below is my code.How can i fix thisimport java.awt.;pu.pdf

Create a java project that - Draw a circle with three random init.pdf von
Create a java project that - Draw a circle with three random init.pdfCreate a java project that - Draw a circle with three random init.pdf
Create a java project that - Draw a circle with three random init.pdfarihantmobileselepun
2 views8 Folien
Casa von
CasaCasa
Casamiguelcastromejia
185 views1 Folie
create file name as board.javawrite below codeimport java.aw.pdf von
create file name as board.javawrite below codeimport java.aw.pdfcreate file name as board.javawrite below codeimport java.aw.pdf
create file name as board.javawrite below codeimport java.aw.pdfproloyankur01
4 views12 Folien
Creating an Uber Clone - Part VIII.pdf von
Creating an Uber Clone - Part VIII.pdfCreating an Uber Clone - Part VIII.pdf
Creating an Uber Clone - Part VIII.pdfShaiAlmog1
282 views25 Folien
Ocr code von
Ocr codeOcr code
Ocr codewi7sonjoseph
178 views23 Folien
Introduction to graphics programming in c von
Introduction to graphics programming in cIntroduction to graphics programming in c
Introduction to graphics programming in cbaabtra.com - No. 1 supplier of quality freshers
12.6K views39 Folien

Similar a Below is my code.How can i fix thisimport java.awt.;pu.pdf(20)

Create a java project that - Draw a circle with three random init.pdf von arihantmobileselepun
Create a java project that - Draw a circle with three random init.pdfCreate a java project that - Draw a circle with three random init.pdf
Create a java project that - Draw a circle with three random init.pdf
create file name as board.javawrite below codeimport java.aw.pdf von proloyankur01
create file name as board.javawrite below codeimport java.aw.pdfcreate file name as board.javawrite below codeimport java.aw.pdf
create file name as board.javawrite below codeimport java.aw.pdf
proloyankur014 views
Creating an Uber Clone - Part VIII.pdf von ShaiAlmog1
Creating an Uber Clone - Part VIII.pdfCreating an Uber Clone - Part VIII.pdf
Creating an Uber Clone - Part VIII.pdf
ShaiAlmog1282 views
import java.util.Scanner;public class Main {    public static in.pdf von anwarsadath111
import java.util.Scanner;public class Main {    public static in.pdfimport java.util.Scanner;public class Main {    public static in.pdf
import java.util.Scanner;public class Main {    public static in.pdf
anwarsadath1115 views
Computer graphics file (3rd semester) von Ketan Rajpal
Computer graphics file (3rd semester)Computer graphics file (3rd semester)
Computer graphics file (3rd semester)
Ketan Rajpal163 views
2Bytesprog2 course_2014_c9_graph von kinan keshkeh
2Bytesprog2 course_2014_c9_graph2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph
kinan keshkeh276 views
Write a java code to build an implementation of a weighted graph ADT-.docx von lez31palka
Write a java code to build an implementation of a weighted graph ADT-.docxWrite a java code to build an implementation of a weighted graph ADT-.docx
Write a java code to build an implementation of a weighted graph ADT-.docx
lez31palka2 views
Cg my own programs von Amit Kapoor
Cg my own programsCg my own programs
Cg my own programs
Amit Kapoor3.9K views
Computer graphics File for Engineers von varun arora
Computer graphics File for EngineersComputer graphics File for Engineers
Computer graphics File for Engineers
varun arora67 views
ORM is an Offensive Anti-Pattern von Yegor Bugayenko
ORM is an Offensive Anti-PatternORM is an Offensive Anti-Pattern
ORM is an Offensive Anti-Pattern
Yegor Bugayenko1.4K views
Python 03-parameters-graphics.pptx von TseChris
Python 03-parameters-graphics.pptxPython 03-parameters-graphics.pptx
Python 03-parameters-graphics.pptx
TseChris10 views

Más de aminaENT

Bills value functionSuppose Bill were to experience a large nega.pdf von
Bills value functionSuppose Bill were to experience a large nega.pdfBills value functionSuppose Bill were to experience a large nega.pdf
Bills value functionSuppose Bill were to experience a large nega.pdfaminaENT
30 views1 Folie
BigCo fabrica solo dos productos (Producto A y Producto B) y utiliza.pdf von
BigCo fabrica solo dos productos (Producto A y Producto B) y utiliza.pdfBigCo fabrica solo dos productos (Producto A y Producto B) y utiliza.pdf
BigCo fabrica solo dos productos (Producto A y Producto B) y utiliza.pdfaminaENT
22 views1 Folie
Beth participa en una investigaci�n sobre posibles violaciones del.pdf von
Beth participa en una investigaci�n sobre posibles violaciones del.pdfBeth participa en una investigaci�n sobre posibles violaciones del.pdf
Beth participa en una investigaci�n sobre posibles violaciones del.pdfaminaENT
3 views1 Folie
Belle Company reports the following information for the current year.pdf von
Belle Company reports the following information for the current year.pdfBelle Company reports the following information for the current year.pdf
Belle Company reports the following information for the current year.pdfaminaENT
25 views1 Folie
Ben, tenemos que hablar, dijo Melissa. S� que tenemos ocho hijos, .pdf von
Ben, tenemos que hablar, dijo Melissa. S� que tenemos ocho hijos, .pdfBen, tenemos que hablar, dijo Melissa. S� que tenemos ocho hijos, .pdf
Ben, tenemos que hablar, dijo Melissa. S� que tenemos ocho hijos, .pdfaminaENT
3 views1 Folie
Beneficio discrecional Muchos profesionales de compensaci�n se enf.pdf von
Beneficio discrecional Muchos profesionales de compensaci�n se enf.pdfBeneficio discrecional Muchos profesionales de compensaci�n se enf.pdf
Beneficio discrecional Muchos profesionales de compensaci�n se enf.pdfaminaENT
22 views1 Folie

Más de aminaENT(20)

Bills value functionSuppose Bill were to experience a large nega.pdf von aminaENT
Bills value functionSuppose Bill were to experience a large nega.pdfBills value functionSuppose Bill were to experience a large nega.pdf
Bills value functionSuppose Bill were to experience a large nega.pdf
aminaENT30 views
BigCo fabrica solo dos productos (Producto A y Producto B) y utiliza.pdf von aminaENT
BigCo fabrica solo dos productos (Producto A y Producto B) y utiliza.pdfBigCo fabrica solo dos productos (Producto A y Producto B) y utiliza.pdf
BigCo fabrica solo dos productos (Producto A y Producto B) y utiliza.pdf
aminaENT22 views
Beth participa en una investigaci�n sobre posibles violaciones del.pdf von aminaENT
Beth participa en una investigaci�n sobre posibles violaciones del.pdfBeth participa en una investigaci�n sobre posibles violaciones del.pdf
Beth participa en una investigaci�n sobre posibles violaciones del.pdf
aminaENT3 views
Belle Company reports the following information for the current year.pdf von aminaENT
Belle Company reports the following information for the current year.pdfBelle Company reports the following information for the current year.pdf
Belle Company reports the following information for the current year.pdf
aminaENT25 views
Ben, tenemos que hablar, dijo Melissa. S� que tenemos ocho hijos, .pdf von aminaENT
Ben, tenemos que hablar, dijo Melissa. S� que tenemos ocho hijos, .pdfBen, tenemos que hablar, dijo Melissa. S� que tenemos ocho hijos, .pdf
Ben, tenemos que hablar, dijo Melissa. S� que tenemos ocho hijos, .pdf
aminaENT3 views
Beneficio discrecional Muchos profesionales de compensaci�n se enf.pdf von aminaENT
Beneficio discrecional Muchos profesionales de compensaci�n se enf.pdfBeneficio discrecional Muchos profesionales de compensaci�n se enf.pdf
Beneficio discrecional Muchos profesionales de compensaci�n se enf.pdf
aminaENT22 views
Bellman equations and dynamic programmingSuppose we are in an MD.pdf von aminaENT
Bellman equations and dynamic programmingSuppose we are in an MD.pdfBellman equations and dynamic programmingSuppose we are in an MD.pdf
Bellman equations and dynamic programmingSuppose we are in an MD.pdf
aminaENT5 views
Belvedere Inc. tiene una n�mina anual de $50 millones. La empresa pa.pdf von aminaENT
Belvedere Inc. tiene una n�mina anual de $50 millones. La empresa pa.pdfBelvedere Inc. tiene una n�mina anual de $50 millones. La empresa pa.pdf
Belvedere Inc. tiene una n�mina anual de $50 millones. La empresa pa.pdf
aminaENT32 views
below you will find the condensed finacial statements for Koko Inc. .pdf von aminaENT
below you will find the condensed finacial statements for Koko Inc. .pdfbelow you will find the condensed finacial statements for Koko Inc. .pdf
below you will find the condensed finacial statements for Koko Inc. .pdf
aminaENT3 views
Below is the January operating budget for Casey Corp., a retailer.pdf von aminaENT
Below is the January operating budget for Casey Corp., a retailer.pdfBelow is the January operating budget for Casey Corp., a retailer.pdf
Below is the January operating budget for Casey Corp., a retailer.pdf
aminaENT5 views
Bassett Fruit Farm espera que su EBIT sea de $385 000 al a�o para si.pdf von aminaENT
Bassett Fruit Farm espera que su EBIT sea de $385 000 al a�o para si.pdfBassett Fruit Farm espera que su EBIT sea de $385 000 al a�o para si.pdf
Bassett Fruit Farm espera que su EBIT sea de $385 000 al a�o para si.pdf
aminaENT4 views
BE Games necesita 20 millones para financiar su �ltima aventura. La .pdf von aminaENT
BE Games necesita 20 millones para financiar su �ltima aventura. La .pdfBE Games necesita 20 millones para financiar su �ltima aventura. La .pdf
BE Games necesita 20 millones para financiar su �ltima aventura. La .pdf
aminaENT3 views
Becky Shelton, maestra de la escuela secundaria Kemp, est� a cargo d.pdf von aminaENT
Becky Shelton, maestra de la escuela secundaria Kemp, est� a cargo d.pdfBecky Shelton, maestra de la escuela secundaria Kemp, est� a cargo d.pdf
Becky Shelton, maestra de la escuela secundaria Kemp, est� a cargo d.pdf
aminaENT3 views
Below is information for a company�s 2020 income statement. The comp.pdf von aminaENT
Below is information for a company�s 2020 income statement. The comp.pdfBelow is information for a company�s 2020 income statement. The comp.pdf
Below is information for a company�s 2020 income statement. The comp.pdf
aminaENT2 views
based on the result, please provide answer for three questions. es.pdf von aminaENT
based on the result, please provide answer for three questions. es.pdfbased on the result, please provide answer for three questions. es.pdf
based on the result, please provide answer for three questions. es.pdf
aminaENT4 views
Based on the above Project Charter and the planning meeting, develop.pdf von aminaENT
Based on the above Project Charter and the planning meeting, develop.pdfBased on the above Project Charter and the planning meeting, develop.pdf
Based on the above Project Charter and the planning meeting, develop.pdf
aminaENT5 views
Below is a diagram showing the digestion of the lmd24 plasmid cut wi.pdf von aminaENT
Below is a diagram showing the digestion of the lmd24 plasmid cut wi.pdfBelow is a diagram showing the digestion of the lmd24 plasmid cut wi.pdf
Below is a diagram showing the digestion of the lmd24 plasmid cut wi.pdf
aminaENT2 views
Based on the givena = 100I = 600G = 300X = 100M = 100F.pdf von aminaENT
Based on the givena = 100I = 600G = 300X = 100M = 100F.pdfBased on the givena = 100I = 600G = 300X = 100M = 100F.pdf
Based on the givena = 100I = 600G = 300X = 100M = 100F.pdf
aminaENT4 views
Based on the following information about Banks A and B, compute for .pdf von aminaENT
Based on the following information about Banks A and B, compute for .pdfBased on the following information about Banks A and B, compute for .pdf
Based on the following information about Banks A and B, compute for .pdf
aminaENT5 views
Based on gene expression analysis, TLR8 (Toll like receptor 8) was i.pdf von aminaENT
Based on gene expression analysis, TLR8 (Toll like receptor 8) was i.pdfBased on gene expression analysis, TLR8 (Toll like receptor 8) was i.pdf
Based on gene expression analysis, TLR8 (Toll like receptor 8) was i.pdf
aminaENT4 views

Último

Class 9 lesson plans von
Class 9 lesson plansClass 9 lesson plans
Class 9 lesson plansTARIQ KHAN
68 views34 Folien
Java Simplified: Understanding Programming Basics von
Java Simplified: Understanding Programming BasicsJava Simplified: Understanding Programming Basics
Java Simplified: Understanding Programming BasicsAkshaj Vadakkath Joshy
625 views155 Folien
11.30.23A Poverty and Inequality in America.pptx von
11.30.23A Poverty and Inequality in America.pptx11.30.23A Poverty and Inequality in America.pptx
11.30.23A Poverty and Inequality in America.pptxmary850239
86 views18 Folien
StudioX.pptx von
StudioX.pptxStudioX.pptx
StudioX.pptxNikhileshSathyavarap
89 views18 Folien
Create a Structure in VBNet.pptx von
Create a Structure in VBNet.pptxCreate a Structure in VBNet.pptx
Create a Structure in VBNet.pptxBreach_P
82 views8 Folien
Guess Papers ADC 1, Karachi University von
Guess Papers ADC 1, Karachi UniversityGuess Papers ADC 1, Karachi University
Guess Papers ADC 1, Karachi UniversityKhalid Aziz
83 views17 Folien

Último(20)

Class 9 lesson plans von TARIQ KHAN
Class 9 lesson plansClass 9 lesson plans
Class 9 lesson plans
TARIQ KHAN68 views
11.30.23A Poverty and Inequality in America.pptx von mary850239
11.30.23A Poverty and Inequality in America.pptx11.30.23A Poverty and Inequality in America.pptx
11.30.23A Poverty and Inequality in America.pptx
mary85023986 views
Create a Structure in VBNet.pptx von Breach_P
Create a Structure in VBNet.pptxCreate a Structure in VBNet.pptx
Create a Structure in VBNet.pptx
Breach_P82 views
Guess Papers ADC 1, Karachi University von Khalid Aziz
Guess Papers ADC 1, Karachi UniversityGuess Papers ADC 1, Karachi University
Guess Papers ADC 1, Karachi University
Khalid Aziz83 views
11.28.23 Social Capital and Social Exclusion.pptx von mary850239
11.28.23 Social Capital and Social Exclusion.pptx11.28.23 Social Capital and Social Exclusion.pptx
11.28.23 Social Capital and Social Exclusion.pptx
mary850239409 views
Monthly Information Session for MV Asterix (November) von Esquimalt MFRC
Monthly Information Session for MV Asterix (November)Monthly Information Session for MV Asterix (November)
Monthly Information Session for MV Asterix (November)
Esquimalt MFRC98 views
The Accursed House by Émile Gaboriau von DivyaSheta
The Accursed House  by Émile GaboriauThe Accursed House  by Émile Gaboriau
The Accursed House by Émile Gaboriau
DivyaSheta246 views
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx von Niranjan Chavan
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptxGuidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx
Niranjan Chavan38 views
INT-244 Topic 6b Confucianism von S Meyer
INT-244 Topic 6b ConfucianismINT-244 Topic 6b Confucianism
INT-244 Topic 6b Confucianism
S Meyer44 views
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE... von Nguyen Thanh Tu Collection
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...
Narration lesson plan von TARIQ KHAN
Narration lesson planNarration lesson plan
Narration lesson plan
TARIQ KHAN69 views

Below is my code.How can i fix thisimport java.awt.;pu.pdf

  • 1. Below is my code. How can i fix this? import java.awt.*; public class IfGrid { public static void main(String[] args) { DrawingPanel panel = new DrawingPanel(400, 400); panel.setBackground(Color.blue); Graphics g = panel.getGraphics(); int sizeX = 40; int sizeY = 40; for (int x = 0; x < 10; x++) { for (int y = 0; y < 10; y++) { int cornerX = x*sizeX; int cornerY = y*sizeY; if ((x + y)%2==0 ); g.setColor(Color.green); else g.setColor(Color.yellow); g.fillRect(cornerX, cornerY, sizeX-1, sizeY-1); g.setColor(Color.black); g.drawString("x="+x, cornerX+10, cornerY+15); // text is positioned at its baseline g.drawString("y="+y, cornerX+10, cornerY+33); // offsets from the corner do centering } } } } Make a checkboard pattern. Hint look at the sum x+y for the green squares. Copy your modified if statement into your solutions document.