java write a graphical application that displays a checkerboard with 64 squares, alternating white and black

Answers

Answer 1

java write a graphical application that displays a checkerboard with 64 squares, alternating white and black

import java.awt.Graphics2D;

import java.awt.Rectangle;

import java.awt.Color;

/**

 This class displays a checkerboard with squares,

 alternating between white and black.

*/

public class CheckerBoard

{

 /**

    Creates a CheckerBoard object with a given number of squares.

     aNumSquares the number of squares in each row

    aSize the size of each square

 */

 public CheckerBoard(int aNumSquares, int aSize)

 {

    numSquares = aNumSquares;

    size = aSize;

 }

 /**

    Method used to draw the checkerboard.

    g2 the graphics content

 */

 public void draw(Graphics2D g2)

 {

     int rows = numSquares * size;

     int columns = numSquares * size;

         if (rows %2 == columns %2)

            g2.setColor(Color.white);

         else

            g2.setColor(Color.black);

 }

 private int numSquares;

 private int size;

}

To know more about Java visit

brainly.com/question/29897053

#SPJ4


Related Questions

What are some things you need to be careful not to change while editing a macro? Check all that apply. commas names spaces brackets rows columns

Answers

Answer:

commas, spaces, brackets

Explanation:

I hope this helps.

what is the weather in Ireland?​

Answers

Answer:

Year-round, Irish weather as a whole tends to stick with what it knows: Mildly crisp weather, around 270 days of rain, with sunshine and wind. Although slight fluctuations occur dependent on the month and season, the average yearly temperature is around 50 degrees Fahrenheit.

Answer:

hi

Explanation:

The climate of Ireland is mild, humid and changeable with abundant rainfall and a lack of temperature extremes. ... January and February are the coldest months of the year, and mean daily air temperatures fall between 4 and 7 °C (39.2 and 44.6 °F) during these months.

have a nice day

I love Ireland very much

I have this project and I can't do anything about it, I do really need help ASAP

Answers

sorry i can't i am confused

The UNIX cal command prints out the calendar of the month/year that the user enters. Type in the following, one at a time, and observe the output:
cal 3 2014 cal 2014 cal 1 1
To learn more about this command, type in man cal for help.
Write a program named cal.c that prints out the following (which is the output when you type in cal 10 2018 in UNIX). Note that you are not asked to implement the cal command. You can assume that you know October 1 is a Monday. You will need to use loops and the % operator.
October 2018 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Answers

Solution :

#include<[tex]$\text{stdio.h}$[/tex]>

int [tex]$\text{dayofweek}$[/tex](int d, [tex]$\text{int m}$[/tex], int y){

static [tex]$\text{int t}[]$[/tex] = { 0, [tex]$3,2$[/tex], 5, [tex]$0,3$[/tex], 5, 1, [tex]$4,6,2,4$[/tex] };

y -= [tex]$m<3$[/tex];

return ([tex]$y+$[/tex] y/4 - y/100 + y/400 + t[m-1] + d) % 7;

}

int main() {

int month,year,i;

printf("Enter Month : ");

scanf("%d",&month);

printf("Enter Year : ");

scanf("%d",&year);

//find week day number

int day = dayofweek(1,month,year);

char * weekDays[] = {"Su","Mo","Tu","We","Th","Fr","Sa"};

printf("\n");

//print week day header

for(i=0;i<7;i++)

printf("%s ",weekDays[i]);

printf("\n");

//print days accordingly

for(i=0;i<day;i++)

printf(" ");

for(i=day;i<=day+30;i++){

printf("%-2d ",i-day+1);

if((i+day)%7==0)

printf("\n");

}

}

A processor has word-addressable memory with all instructions of length 1 word (which is equal to 4 bytes). At a given point in time, the current instruction being executed has an operand field with the value 7C30. At this time, suppose the Program Counter contains the address 49A072, the register R3 contains the value 5600, and the register R4 contains the value 3A. All addresses and values above are in hex. For each of the following addressing modes, find the effective address of the operand:______.
a) Direct mode
b) PC-relative mode
c) Displacement mode with base register R3 and displacement given by the operand field
d) Indexed mode with index register R4 and base address given by the operand field

Answers

Answer:

i dont

Explanation:

know im lazy to do it but it looks easy just put some effort into it youg ot it!

What is the most important part of the brainstorming process?

Answers

Answer:

Some people may say that the most important part of brainstorming is the ability to come up with creative ideas, but this end result is still linked to the need for a lack of judgement or criticism during the session.

Explanation:

brainliest please

5.27 LAB*: Program: Soccer team roster (Vectors)
This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balanced team.
(1) Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jersey numbers in one int vector and the ratings in another int vector. Output these vectors (i.e., output the roster). (3 pts)
Ex:
Enter player 1's jersey number:
84
Enter player 1's rating:
7
Enter player 2's jersey number:
23
Enter player 2's rating:
4
Enter player 3's jersey number:
4
Enter player 3's rating:
5
Enter player 4's jersey number:
30
Enter player 4's rating:
2
Enter player 5's jersey number:
66
Enter player 5's rating:
9
ROSTER
Player 1 -- Jersey number: 84, Rating: 7
Player 2 -- Jersey number: 23, Rating: 4
...
(2) Implement a menu of options for a user to modify the roster. Each option is represented by a single character. The program initially outputs the menu, and outputs the menu after a user chooses an option. The program ends when the user chooses the option to Quit. For this step, the other options do nothing. (2 pts)
Ex:
MENU
a - Add player
d - Remove player
u - Update player rating
r - Output players above a rating
o - Output roster
q - Quit
Choose an option:
(3) Implement the "Output roster" menu option. (1 pt)
Ex:
ROSTER
Player 1 -- Jersey number: 84, Rating: 7
Player 2 -- Jersey number: 23, Rating: 4
...
(4) Implement the "Add player" menu option. Prompt the user for a new player's jersey number and rating. Append the values to the two vectors. (1 pt)
Ex:
Enter a new player's jersey number:
49
Enter the player's rating:
8
(5) Implement the "Delete player" menu option. Prompt the user for a player's jersey number. Remove the player from the roster (delete the jersey number and rating). (2 pts)
Ex:
Enter a jersey number:
4
(6) Implement the "Update player rating" menu option. Prompt the user for a player's jersey number. Prompt again for a new rating for the player, and then change that player's rating. (1 pt)
Ex:
Enter a jersey number:
23
Enter a new rating for player:
6
(7) Implement the "Output players above a rating" menu option. Prompt the user for a rating. Print the jersey number and rating for all players with ratings above the entered value. (2 pts)
Ex:
Enter a rating:
5

Answers

Answer:

Explanation:

The following code is written in Java and loops five times asking for the desired inputs from the user and saves that information in two Vectors named jerseyNumber and ratings. Then creates a while loop for the menu and a seperate method for each of the options...

import java.util.Scanner;

import java.util.Vector;

class Brainly {

   static Scanner in = new Scanner(System.in);

   static Vector<Integer> jerseyNumber = new Vector<>();

   static Vector<Integer> ratings = new Vector<>();

   public static void main(String[] args) {

       for (int x = 0; x < 5; x++) {

           System.out.println("Enter player " + (x+1) + "'s jersey number:");

           jerseyNumber.add(in.nextInt());

           System.out.println("Enter player " + (x+1) + "'s rating:");

           ratings.add(in.nextInt());

       }

       boolean reloop = true;

       while (reloop == true) {

           System.out.println("Menu");

           System.out.println("a - Add player");

           System.out.println("d - Remove player");

           System.out.println("u - Update player rating");

           System.out.println("r - Output players above a rating");

           System.out.println("o - Output roster");

           System.out.println("q - Quit");

           char answer = in.next().charAt(0);

           switch (answer) {

               case 'a': addPlayer();

                   break;

               case 'd': removePlayer();

                   break;

               case 'u': updatePlayer();

                   break;

               case 'r': outputRating();

                   break;

               case 'o': outputRoster();

                   break;

               case 'q': System.exit(0);

                   reloop = false;

                   break;

           }

       }

   }

   public static void addPlayer() {

       System.out.println("Enter player's jersey number:");

       jerseyNumber.add(in.nextInt());

       System.out.println("Enter player's rating:");

       ratings.add(in.nextInt());

   }

   public static void removePlayer() {

       System.out.println("Enter Jersey number:");

       int number = in.nextInt();

       for (int x = 0; x < jerseyNumber.size(); x++) {

           if (jerseyNumber.get(x) == number) {

               jerseyNumber.remove(x);

               ratings.remove(x);

           }

       }

   }

   public static void updatePlayer() {

       System.out.println("Enter Jersey number:");

       int number = in.nextInt();

       System.out.println("Enter new Rating:");

       int rating = in.nextInt();

       for (int x = 0; x < jerseyNumber.size(); x++) {

           if (jerseyNumber.get(x) == number) {

               ratings.set(x, rating);

           }

       }

   }

   public static void outputRating() {

       System.out.println("Enter Rating:");

       int rating = in.nextInt();

       for (int x = 0; x < ratings.size(); x++) {

           if (ratings.get(x) >= rating) {

               System.out.println(jerseyNumber.get(x));

           }

       }

   }

   public static void outputRoster() {

       for (int x = 0; x < jerseyNumber.size(); x++) {

           System.out.println("Player " + (x+1) + " -- Jersey number: " + jerseyNumber.get(x) + ", Rating: " + ratings.get(x));

       }

   }

}

Which technologies combine to make data a critical organizational asset?

Answers

Answer: Is in the image I attached below of my explanation. Hope it helps! Have a wonderful day! <3

Explanation: Brainliest is appreciated, I need 2 more for my next last rank please!

PLEASE HELP there are TWO ANSWERS
Select all the correct answers.
Which two data types can be used to store the sentence "Click to open."?
character
string
float
Boolean
array​

Answers

Answer:

boolean is correct

Explanation:

Answer:

its string and array

Explanation:

Edmonton gang

Briefly explain how Riboflavin deficiency lead to disease state.​

Answers

Answer:

Severe riboflavin deficiency can impair the metabolism of other nutrients, especially other B vitamins, through diminished levels of flavin coenzymes [3]. Anemia and cataracts can develop if riboflavin deficiency is severe and prolonged [1]. The earlier changes associated with riboflavin deficiency are easily reversed.

The ____ character is allowable in a folder name. Select one: a. < b. : c. / d. -

Answers

Answer:

d. - is allowed in a folder name.

Which of the following would a cyber criminal most likely do once they gained access to a user id and password

Answers

Answer:

do something wrong as you

explain the procedure you will undertake to create a new partition​

Answers

Ans: To create and format a new partition (volume) Right-click an unallocated region on your hard disk, and then select New Simple Volume. In the New Simple Volume Wizard, select Next. Enter the size of the volume you want to create in megabytes (MB) or accept the maximum default size, and then select Next.

Now, we’re ready to program! Leave the visualizer and go back to https://repl.it/ to write your program. Here is the pseudocode for your program: Define a function called “even_checker” that will do the following things: Iterate over a list. Check to see whether the values in the list are even. Print the even values. Create a list with ten numbers in it. (Some of your numbers should be odd, and some should be even.) Call the function on your list. When you have tested your program, take a screenshot of it and its output to turn in. If your program does not work properly, also include a paragraph explaining what you did to troubleshoot it.

Answers

Answer:

here

Explanation:

Answer:did you get the answer right or wrong?

Explanation:

What does an operating system provide so you can interact with a device

Answers

Answer:

Operating system software provides the user interface for interacting with the hardware components, whereas application software enables you to accomplish specific tasks.

Explanation:

please give me brainlist and follow

An operating system provides graphical user interface, which enables the user to interact seamlessly with a computer device.

Graphical user interface (GUI) provides user-friendly visual representations to help the user to manage the human interaction with the device via the operating system.

Some graphical user interface tools include icons, menus, and mouse.

Thus, with visual representations of data and operating instructions, users are able to understand the operating system and interact easily with the computer device.

Read more about graphical user interface at https://brainly.com/question/16956142

write a c++ program that accept student information

Answers

Answer:

Structure

This program stores the information (name, roll and marks entered by the user) of a student in a structure and displays it on the screen.

To understand this example, you should have the knowledge of the following C++ programming topics:

C++ StructuresC++ StringsIn this program, a structure(student) is created which contains name, roll and marks as its data member. Then, a structure variable(s) is created. Then, data (name, roll and marks) is taken from user and stored in data members of structure variable s. Finally, the data entered by user is displayed.This structure has three members: name (string), roll (integer) and marks (float).

Then, a structure variable s is created to store information and display it on the screen.

What is the name for the last word on a dictionary page?
a. Final word
c. First guideword
b. Second guideword
d. None of these
Please select the best answer from the choices provided

A
B
XOOO
с

Answers

Answer:

bbbbbbbbbbbbbbbbbbbbbbbb

Explanation:

bbbbbbbbbbbbbbbbbbbbbbbbb

Answer:

B.Second guideword

Explanation:

def test_1():
test_3()
print("A")

def test_2():
print("B")
test_1()

def test_3():
print("C")
What is output by the following line of code?

test_1()

C

A
B
C

A
C

C
A

Answers

Answer:

The output is

C

A

Explanation:

Given

The given code segment

Required

The output of test_1()

When test_1() is called from main, the following is executed:

def test_1():

  test_3()  ---- This calls test_3()

  print("A") --- This is then executed after test_3() has been executed

For test_3()

def test_3():

print("C") --- This prints C

Back to test_1()

  print("A") --- This prints A

So, the output is:

C

A

In this exercise we have to use the knowledge of computational language in python to write the code.

We have the code in the attached image.

The code in python can be found as:

def test_1():

 test_3()

 print("A")

def test_3():

print("C")

Back to test_1()

 print("A")

See more about python at brainly.com/question/26104476

Consider the following recursive method, which is intended to display the binary equivalent of a decimal number. For example, toBinary(100) should display 1100100.

public static void toBinary(int num)
{
if (num < 2)
{
System.out.print(num);
}
else
{
/* missing code */
}
}

Which of the following can replace /* missing code */ so that toBinary works as intended?

a. System.out.print(num % 2);
toBinary(num / 2);

b. System.out.print(num / 2);
toBinary(num % 2);

c. toBinary(num % 2);
System.out.print(num / 2);

d. toBinary(num / 2);
System.out.print(num % 2);

e. toBinary(num / 2);
System.out.print(num / 2);

Answers

Answer:

D) toBinary(num / 2);

System.out.print(num % 2);

Explanation:

Which program enables different computers to transmit data to each other?

A. simple message transfer protocol
B. Hypertext transfer protocol
C. Interactive file transfer protocol
D. Transmission control protocol/Internet protocol

Answers

Answer:

Option D, Transmission control protocol/Internet protocol

Explanation:

Transmission control protocol/Internet protocol is a communication protocol through which files are transferred from the server to the client's system via computer network.

On the internet, It interconnects the network devices and also serve as a communications protocol in a private computer network

Hence, option D is correct

Do you think renewable energy can power the world? If so, why?

Answers

Answer:

yes

Explanation:

Because it is a new safer and more energy efficient way of producing energy

Question 1
1 pts
The pressure of the electrons in a wire is measured in units called
volts
amperes
watts
ohms
The largely instinct 3.5 inch floppy disc uses which connector

Answers

Answer:

Option A, Volts

Explanation:

Volts  is the unit of pressure of the electrons in a wire. One Volt is the required pressure to allow flow of one unit of current in a circuit against a resistance of one ohm.

Hence, option A is correct

what is the output of int s; in c programming?m​

Answers

Answer:

No output

Explanation:

Given

int s;

Required

The output

The above instruction is not an output statement, but rather it is a statement that declares variable s as an integer.

Hence, no output is expected.

To produce an output in C, you make use of the following print statement:

printf("%d", s);

The above instruction prints the value of s

Which of the following characteristics differentiates PCM from BWF audio
file formats?
metadata storage
.wav file extension
uncompressed audio file format
compressed audio file format

Answers

Answer: A

Explanation:

Answer:

A

Explanation:

Consider the following code: def tryIt(b): for i in range(len(b)): b[i] = b[i] + 100 #***********MAIN************ x = [] x = [56, 78, 88] print(x) tryIt(x) print(x) [156, 178, 188] [156, 178, 188] [56, 78, 88] [156, 178, 188] [56, 78, 88] [56, 78, 88]

Answers

Answer: I took a high school robotics class when I was in 5th grade and I don't even understand your code there aren't any instructions other than "Consider" the following code you may want to improve your question

You have been tasked with building a URL file validator for a web crawler. A web crawler is an application that fetches a web page, extracts the URLs present in that page, and then recursively fetches new pages using the extracted URLs. The end goal of a web crawler is to collect text data, images, or other resources present in order to validate resource URLs or hyperlinks on a page. URL validators can be useful to validate if the extracted URL is a valid resource to fetch. In this scenario, you will build a URL validator that checks for supported protocols and file types.
What you need to do?
1. Writing detailed comments and docstrings
2. Organizing and structuring code for readability
3. URL = :///
Steps for Completion
Task
Create two lists of strings - one list for Protocol called valid_protocols, and one list for storing File extension called valid_ftleinfo . For this take the protocol list should be restricted to http , https and ftp. The file extension list should be hrl. and docx CSV.
Split an input named url, and then use the first element to see whether the protocol of the URL is in valid_protocols. Similarly, check whether the URL contains a valid file_info.
Task
Write the conditions to return a Boolean value of True if the URL is valid, and False if either the Protocol or the File extension is not valid.
main.py х +
1 def validate_url(url):
2 *****Validates the given url passed as string.
3
4 Arguments:
5 url --- String, A valid url should be of form :///
6
7 Protocol = [http, https, ftp]
8 Hostname = string
9 Fileinfo = [.html, .csv, .docx]
10 ***
11 # your code starts here.
12
13
14
15 return # return True if url is valid else False
16
17
18 if
19 name _main__': url input("Enter an Url: ")
20 print(validate_url(url))
21
22
23
24
25

Answers

Answer:

Python Code:

def validate_url(url):

#Creating the list of valid protocols and file name extensions

valid_protocols = ['http', 'https', 'ftp']

valid_fileinfo = ['.html', '.csv', '.docx']

#splitting the url into two parts

url_split = url.split('://')

isProtocolValid = False

isFileValid = False

#iterating over the valid protocols and file names for validity

for x in valid_protocols:

if x in url_split[0]:

isProtocolValid = True

break

for x in valid_fileinfo:

if x in url_split[1]:

isFileValid = True

break

#Returning the result if the URL has both valid protocol and file extension

return (isProtocolValid and isFileValid)

url = input("Enter an URL: ")

print(validate_url(url))

Explanation:

The image of the output code is attached. Hope it helps.

what name is given to the method used to copy a file onto a CD

Answers

Answer: Burn or Write

Explanation:

Burn is a colloquial term meaning to write content to a CD , DVD , or other recordable disc. DVD and CD drives with recording capabilities (sometimes called DVD or CD burner s) etch data onto the disks with a laser .

outline four advantages of digital
cameras over analogue cameras​

Answers

Answer:

Explanation:

A digital camera refers to a camera whereby the photographs are being captured in digital memory. An analogue camera refers to the traditional camera that typically sends video over cable.

The advantages of digital cameras over analogue cameras include:

1. Massive Storage Space:

There is a large storage space for photos and thus helps to prevent limitations to film. There are memory cards that can store several images.

2. Multiple functions:

The digital camera performs several functions like face detection, night and motion detection This makes capturing of images more fun and brings about better images.

3. Video Camera:

Digital cameras can also capture moving pictures while analog camera typically captures images that are still. Digital camera is vital as it can be used for live streaming.

4. Smaller and Lighter:

Digital cameras are usually smaller and lighter which makes them more portable and easy to carry about.

What is the output of the following code?
int num=25;
if (num > 5)
System.out.print(num + " ");
num += 10;
}
if (num > 30){
System.out.print(num + " ");
num += 5;
}
if (num > 45 ) {
System.out.print(num);
}​

Answers

Answer:

25 35

Explanation:

First if checks if num is greater than 25, it is so it prints 25 with a space after and adds 10 to num (num is now 35)

Then it checks if num is greater than 30, it is, so it prints 35 with a space after and adds 5 to num (num is now 40)

Lastly, it checks if num is greater than 45, it is not, so the program terminates with output: "25 35 " (note the space at the end)

The vulnerabilities common to the software development process, including buffer overflows, race conditions, input validation attacks, authentication attacks, authorization attacks, and cryptographic attacks, and how we might mitigate these by following secure coding guidelines. Besides protecting O S software on hosts, there is a need to protect applications that run on these devices. Aspects of application security includes all except:____.
A. Application development security.
B. Secure coding techniques.
C. Code testing.
D. Requirement Assessment.

Answers

Answer:

Aspects of application security includes all except:____.

D. Requirement Assessment.

Explanation:

The requirement assessment is carried out during the initial development stage to meet the user's requirements.  This assessment does not necessarily deal with application security.  However, the other three aspects are security-related.  They focus on the areas where application security is mostly required to reduce errors and technical weaknesses of a software, including authentication, privacy, access control, data segregation, and error handling.

Other Questions
Convert the units of capacity.10 pt = ___ ___ qt Solve for x (3x-15) & (2x+7) Contribution Income Statement and Operating Leverage Willamette Valley Fruit Company started as a small cannery-style operation in 1999. The company now processes, on average, 20 million pounds of berries each year. Flash-frozen berries are sold in 30 pound packs to retailers. Assume 650,000 packs were sold for $75 each last year. Variable costs were $42 per pack and fixed costs totaled $14,250,000.Enjoy the berry best blueberries in the world!" The selling price is $90 per crate, variable costs are $80 per crate, and fixed costs are $280,000 per year. In the year 2017, Stateline Berry Farm sold 50,000 crates.Prepare a contribution income statement for the year ended December 31, 2017. HINT: Use a negative sign with both "costs" answers.STATELINE BERRY FARMContribution Income StatementFor the Year Ended December 31, 2017Sales Variable costs Contribution margin Fixed costs Net income brown hair (H) is dominant to blond hair (h). Two hybrid parents have 4 kids. what is the likelihood that their kids will be hybrids as well? (this is punnett square) solve for xNeed help with this last question What roles did John Nance Garner, Jesse Jones, and Sam Rayburn take on at the national level during the Great Depression? Thanks pls somebody help me i need help on this dont get it HELP ME I WILL MARK BRAINLIEST What pigment replaces chlorophyll inthe fall season?A. caroteneB. betateneC. hypotene Elvis and $74 .50 a month.. how much does he earn to the nearest one penny.A. in a yearB. in a weekC. in a day please helo me with these two i dont know them please go i need help 8th grade math Suppose all firms follow similar financing policies, face similar risks, have equal access to capital, and operate in competitive product and capital markets. However, firms face different operating conditions because, for example, the grocery store industry is different from the airline industry. Under these conditions, firms with high profit margins will tend to have high asset turnover ratios, and firms with low profit margins will tend to have low turnover ratios.a. Trueb. False Find the area of a regular pentagon with a side of 10 cm. and an apothem of 4 cm. HHHHEEEEEEELLLLPPPPPPP !!!!!! If the acceleration is 600m/s/s and the mass is 300kg, calculate the force? * Arizona Desert Homes (ADH) constructed a new subdivision during 2020 and 2021 under contract with Cactus Development Co. Relevant data are summarized below: Contract amount $ 3,000,000 Cost: 2020 1,200,000 2021 600,000 Gross profit: 2020 800,000 2021 400,000 Contract billings: 2020 1,500,000 2021 1,500,000 ADH recognizes revenue over time with respect to these contracts. What would be the journal entry made in 2020 to record revenue Why do atoms connect to eachother? The area of a sector with a radius of 22 yards is 89.45 square yards. Calculate the approximate angle of the sector Help p please:)......