Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

liliy Group Title

how do i create a chess board to look like this: ****** ##### ***** ##### ***** ****** ##### ***** ##### ***** ****** ##### ***** ##### ***** ##### ***** ##### ***** ##### ##### ***** ##### ***** ##### ##### ***** ##### ***** ##### etc...

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. liliy Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    in java.

    • 2 years ago
  2. Chris2332 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    - have a flag that will determine whether you print * or # - loop as many times as you need to print * and # and switch the flag after each loop - determine how many rows you want before changing the beginning character that's an initial guide!

    • 2 years ago
  3. liliy Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    if((j%2==0 && i%2==0)||(j%2!=0 && i%2!=0)){ for(int k=0;k<6;k++){ if(a[i]==j) printQ(i); else System.out.print("***************\t###############\t***************\t###############\t***************\t###############\t***************\t###############\n");//****************\t###############\t***************\t###############\t***************\t###############\t***************\t###############\n***************\t###############\t***************\t###############\t***************\t###############\t***************\t###############\n***************\t###############\t***************\t###############\t***************\t###############\t***************\t###############\n***************\t###############\t***************\t###############\t***************\t###############\t***************\t###############\n"); } } if((j%2!=0 && i%2==0)||(j%2==0 && i%2!=0)) for(int k=0;k<6;k++) if(a[i]==j) printQ(i); else System.out.print("###############\t***************\t###############\t***************\t###############\t***************\t###############\t***************\n");//###############\t***************\t###############\t***************\t###############\t***************\t###############\t***************\n###############\t***************\t###############\t***************\t###############\t***************\t###############\t***************\n###############\t***************\t###############\t***************\t###############\t***************\t###############\t***************\n###############\t***************\t###############\t***************\t###############\t***************\t###############\t***************\n"); }

    • 2 years ago
  4. liliy Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    my print Q(i): takes it to antoher method that checks if that "box" should get a special symbol and will replace the * or # with the symbol. but it doesnt work!!!AHHH!!

    • 2 years ago
  5. jon.stromer.galley Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Let's assume for now that we don't want to pass some of our parameters about all over the place and instead we will use some class fields to store info. Specifically: int rows = 8; int cols = 8; int cellHeight = 3; int cellWidth = 5; Now, you might create some functions to perform the work for you: void printBoard() { // we are going to call printRow() "rows" times } void printRow(int currRow) { // a row is actually comprised of cellHeight sub rows // for each subrow we are going to call printCell() "cols" times } void printCell(int currRow, int currCol) { // this cell will print either "*" or # repeated cellWidth times // what does (currRow +currCol ) % 2 give you? }

    • 2 years ago
  6. liliy Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    thank you so much, you really helped. but how do i make it tabbed? wher do i put the \t? because right now its just one long thing going down one collumn. i want it to be a board!:(

    • 2 years ago
  7. jon.stromer.galley Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    you can select a "column separator" either space or tab or whatever and print it as the last thing you do in printCell() Let me know if you would like to see some more of a complete example.

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.