Question
For Java please

e a program imed Checkerboord Jan, that pronges the user nming towork for arty N value(ie N+4,N=7, N:24) For example For N=5 to efter one me er valie N The program eut uts a t odmensonal N-ty-N checkerboard Niem with alemi ng spaces and ashen s bea Your pe a n
0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.util.Scanner;

class Main {
public static void main(String[] args) {
  
// declaring variables
int N;
Scanner sc = new Scanner(System.in);
  
// taking user input
System.out.print("Enter value of N: ");
N = sc.nextInt();
char symbol = '*';
  
System.out.println("My Checkboard\n");
  
// for n lines
for(int i=0; i<N; i++)
{
// for 2n symbols in 1 line
for(int j=0; j<2*N; j++)
{
// PRINTING symbol
System.out.print(symbol);
  
// modifying symbol to have alternate * and space
if(symbol == '*')
symbol = ' ';
else
symbol = '*';
}
// since we want differnt symbol in the next line, modifying symbol to have alternate * and space
if(symbol == '*')
symbol = ' ';
else
symbol = '*';
System.out.println();
}
  
}
}

/*SAMPLE OUTPUT
Enter value of N: 7 My Checkboard

*/

Add a comment
Know the answer?
Add Answer to:
For Java please e a program imed Checkerboord Jan, that pronges the user nming towork for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please help me with this program in Java: Write a Java program that prompts the user...

    Please help me with this program in Java: Write a Java program that prompts the user to enter a password that matches a specific pattern. Your program must approve the user's entry.. Here is the pattern, in this order: 1 or more upper case letters two lower case letters 1 or 2 digits zero or 1 upper case letters any two of this group @#$%^&

  • Write a Java program which asks the user to enter an integer x. This program prints...

    Write a Java program which asks the user to enter an integer x. This program prints the remainder of x when it is divided by 3. Example Pl ea s e e n t e r an i n t e g e r : 3 remainde r=0 Pl ea s e e n t e r an i n t e g e r : 17 remainde r=2

  • Please write a java program that takes a large, user-entered number (usually 10 digits) and tallies...

    Please write a java program that takes a large, user-entered number (usually 10 digits) and tallies the 10 digits to be used in an array. Then, the method should tell the user how many of each number was input. For example, for the number 445903218, the program should say "2 4's, 1 5...," etc etc.

  • please use java Write a program that prompts the user to enter line of text (including...

    please use java Write a program that prompts the user to enter line of text (including whitespace). The program then replaces the following vocals with numbers: a = 1, e = 2, i = 3, o = 4, u = 5 and outputs the result to the console. The program does not consider case, so a = 1, A = 1, e = 2, E = 2, etc. Example: Input: Hello, how are you? Output: H2ll4, h4w 1r2 y45? The...

  • solve it with Java please Write a Java program that prompts the user to input length...

    solve it with Java please Write a Java program that prompts the user to input length and width of a shape. If length is equal to width, call a method to calculate the area of the shape and send only one side as parameter to this method. This meth return the area of the shape. If length is not equal to width, call a method to calculate the area of the shape and send both width and length as parameters...

  • In Java, please write the program for the following program. Please TEST YOUR PROGRAM. You MUST...

    In Java, please write the program for the following program. Please TEST YOUR PROGRAM. You MUST use GUI, that means all user input must be through the windows. The "first window" is the window on the top left of the following picture. Add 5 more items to be purchased. Search is accessed from second window, top right. Thw third window is the bottom left, and the fourth window is the bottom right. The program MUST CONTAIN EVERYTHING IN THE PICTURES....

  • Write a Java program that reads a series of strings from a user until STOP is...

    Write a Java program that reads a series of strings from a user until STOP is entered. Each input consists of information about one student at the ABC Professional School. The input consists of the student’s last name (the first 15 characters with extra blanks on the right if the name is not 15 characters long), the student’s number (the next 4 characters, all digits, a number between 1000 and 5999), and the student’s program of study (one character, either...

  • Please write a Java program that ask the user how many beers he or she expects...

    Please write a Java program that ask the user how many beers he or she expects to consume each day, on average, as well as the average amount of money he or she spends on a single 12-ounce can of beer. Studies have shown that, on average, someone who consumes a single 12-ounce can of beer every day without compensating for the calorie intake through diet modifications or extra exercise, will gain approximately 15 pounds in one year. You can...

  • Java Programming. Please make sure program compiles, the code is copyable, and screenshots of the output...

    Java Programming. Please make sure program compiles, the code is copyable, and screenshots of the output are provided for 5 stars :-) Calculation for speed is just supposed to be google searched 1) 18 points] You've been hired by Pedal Punchers to write a Java console application that estimates bicycle speed in miles per hour. Use a validation loop to prompt for and get from the user the wheel diameter of a bicycle in inches in the range 10-50. Then...

  • Please help me write this Java program. I had posted this question before, but got an...

    Please help me write this Java program. I had posted this question before, but got an answer that was totally wrong. We are using the latest version of Java8. Thank You! -------------------------------------------------------------------------------------- Write a Java program that can successfully DECRYPT a string inputted by the user which has been encrypted using a Caesar Cipher with a unknown shift value(key). You can use brute force to do a for loop through all the 26 shift values, however, your program should only...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT