phpBB Forum
 
It is currently Wed Mar 25, 2020 4:01 pm




Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2, 3  Next
Some Java Advice 
Author Message
HH Donor
HH Donor
User avatar

Joined: Sun Feb 15, 2009 9:23 pm
Posts: 4908
Location: Aruba
STEAM_0:1:11237970
MCID: pgt
Post Some Java Advice
Hey guys,
just doing some Java and I'm quite stuck with these 2 exercises.
I'm supposed to do them with the "for" loop.



I'll appreciate any help I can get.
Thanks :-)

_________________


Thu Apr 22, 2010 3:03 pm
Profile E-mail
HH Donor
HH Donor
User avatar

Joined: Sat Dec 15, 2007 3:03 am
Posts: 303
Location: Roskilde, Denmark
STEAM_0:0:1066641
MCID: ipwndk
Post Re: Some Java Advice
You gotta print that out?

_________________
I R FERNIUS MAXIMUS


Thu Apr 22, 2010 3:47 pm
Profile E-mail WWW
HH Donor
HH Donor
User avatar

Joined: Sat Dec 15, 2007 3:03 am
Posts: 303
Location: Roskilde, Denmark
STEAM_0:0:1066641
MCID: ipwndk
Post Re: Some Java Advice
I'm attempting to find out what the system is :)

So in the first, you got 5, which is surrounded by a triangle of 4's, that are surrounded by a .... to 1.

Give me a minute.

Also, there is always a length of 5 to any edge.


Last edited by i pwn on Thu Apr 22, 2010 3:52 pm, edited 1 time in total.



Thu Apr 22, 2010 3:50 pm
Profile E-mail WWW
HH Donor
HH Donor
User avatar

Joined: Sun Feb 15, 2009 9:23 pm
Posts: 4908
Location: Aruba
STEAM_0:1:11237970
MCID: pgt
Post Re: Some Java Advice
nah dont gotta print that. just send in the code.

god i hate BlueJ.


Thu Apr 22, 2010 3:52 pm
Profile E-mail
HH Donor
HH Donor
User avatar

Joined: Sat Dec 15, 2007 3:03 am
Posts: 303
Location: Roskilde, Denmark
STEAM_0:0:1066641
MCID: ipwndk
Post Re: Some Java Advice
Oh, I meant as in write Java to print to console :)

The first assignment requires whitespace


Thu Apr 22, 2010 3:52 pm
Profile E-mail WWW
HH Donor
HH Donor
User avatar

Joined: Sun Feb 15, 2009 9:23 pm
Posts: 4908
Location: Aruba
STEAM_0:1:11237970
MCID: pgt
Post Re: Some Java Advice
i pwn wrote:
Oh, I meant as in write Java to print to console :)

The first assignment requires whitespace

i've done most of the assignments with this construct

Quote:
for (int i=1; i<=10; i++ ) {
System.out.println(i);
if (i==5) {
break;
}
}
System.out.println("Fertig");


just copied the code from one assignment, so dont worry about the jibbi jabba in it.


Thu Apr 22, 2010 4:12 pm
Profile E-mail
HH Donor
HH Donor
User avatar

Joined: Sat Dec 15, 2007 3:03 am
Posts: 303
Location: Roskilde, Denmark
STEAM_0:0:1066641
MCID: ipwndk
Post Re: Some Java Advice
This prints the pyramid of only 1's. I'm still working on the system.
Code:
      for (int i = 0, l = 8; i < 9; i++, l--) {
         for (int j = 0; j < 17; j++) {
            if (j < l || j > l + (16 - (l+l)))
               System.out.print(" ");
            else
               System.out.print(1);
         }
         System.out.println();
      }


Ack, I'm a bit stuck here. Can't seem to figure it out at the moment :|

I'll write later if I figure something out. Gotta eat and work on some Java on my own now :)

EDIT: Think I got an idea. A number has an amount of preceding numbers, and a an amount of possible descendant numbers. In the system it seems as when the amount of descendent numbers are less than preceding numbers it counts down. (This is vertically)

But I must eat first before I try it out. Looks good on paper though.


Thu Apr 22, 2010 4:14 pm
Profile E-mail WWW
HH Donor
HH Donor
User avatar

Joined: Sun Feb 15, 2009 9:23 pm
Posts: 4908
Location: Aruba
STEAM_0:1:11237970
MCID: pgt
Post Re: Some Java Advice
thanks good sir! :D


Thu Apr 22, 2010 4:37 pm
Profile E-mail
HH Donor
HH Donor
User avatar

Joined: Fri Apr 25, 2008 5:02 am
Posts: 1865
Location: Your nightmares
STEAM_0:0:4361645
Post Re: Some Java Advice
Sorry for the OT but I couldn't resist the joke opportunity. :P

Java wrote:
Piercings are awesome. Since I have such a large manhood I needed a sturdy poker for my piercing or it would have just looked stupid.


Java wrote:
Mac, PC, Linux and whatever does not really matter.

Having a big blue wang does!

I win


Java wrote:
THERE WILL BE SMUG BLUE WANG


Problem solved? :lol:


Thu Apr 22, 2010 5:14 pm
Profile E-mail
HH Donor
HH Donor
User avatar

Joined: Sun Feb 15, 2009 9:23 pm
Posts: 4908
Location: Aruba
STEAM_0:1:11237970
MCID: pgt
Post Re: Some Java Advice
more problems caused in my head than solved. but thanks for the effort :P


Thu Apr 22, 2010 5:19 pm
Profile E-mail
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2, 3  Next


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © phpBB Group.
Designed by Vjacheslav Trushkin for Free Forum/DivisionCore.