• Post Reply Bookmark Topic Watch Topic
  • New Topic

Wrap me around  RSS feed

 
Niko Fricker
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The output should be: .

This is what mine is: .
So what I need help with is getting the lines of x's to wrap around (the x's are supposed to represent the spaces for now). But I can't think of a way to do it. Also I know how to get the date inputs that are above and below, I just need help on the main structure of the calendar right now.
 
Niko Fricker
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just noticed that the pictures aren't posting for some reason, give me a second to figure it out...
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Niko Fricker wrote:
For some reason the pictures aren't working so I uploaded them to imgur so you can see them there. Just follow the links.


The Image tag is for links to image files -- and not to web pages that happens to have images on them.

Alternatively, another option is to upload the images directly to the ranch. On the post creation screen, there should be an "attachment" tag, which will allow you to upload images (no need to use a third party site).

Henry
 
Ron McLeod
Bartender
Posts: 1603
232
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Niko Fricker wrote:Just noticed that the pictures aren't posting for some reason, give me a second to figure it out...

I fixed your images.  You need to include the URL to the actual images (.png), not the URL to the web page.
 
Niko Fricker
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for fixing the two pictures, but can anyone tell me what I need to do in order to get my code to wrap back around, and still not be static?
 
Junilu Lacar
Sheriff
Posts: 11493
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, isn't the logic simply as follows?

1. Print dashes for one box X number of times (where X is the number of days per row)
2. Print a new line
3. Repeat 1 - 2 however many number of rows you want to print in your calendar.
 
Junilu Lacar
Sheriff
Posts: 11493
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to read through some of this thread: https://coderanch.com/t/675952/java/java/Code-Review to get ideas on how to systematically attack your problem. This is just another pattern that you have to figure out an algorithm for, much like what was needed to solve the problem discussed in that other thread.
 
salvin francis
Bartender
Posts: 1660
37
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ensure you post valid code so that we can help you better, you code has a missing brace "}" at the end of it.
Next, your variable names c,d,f,g are quite confusing and do not show what you intend to do
For the solution, all you need to "wrap around" is to place a new line in your code.
You have already done so for line 20,30.

Hint, its in one of your loops.
 
salvin francis
Bartender
Posts: 1660
37
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Btw, why does your requirement requires days to be 32,33,34,35 ? It's a calendar right ?
Does 9 / 20 refers to 20th September ?
If yes, whats so special about 20 in the expected output ?
 
Niko Fricker
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right now I'm just trying to get the basics of it all down. So I'm basically making a non-static 7x5 box that has stuff inside of it.
 
salvin francis
Bartender
Posts: 1660
37
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Niko Fricker wrote:I'm basically making a non-static 7x5 box that has stuff inside of it.

okay, you should have mentioned early on in the thread so that you would get good quality replies to solve your issue rather than queries for what you want to achieve. So, we are no longer taking about months, days and calendars, we are just taking about drawing a box grid with numbers in it.

Did my hint about the new line help ?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!