Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Amateur needs HALP PLZ

Name: Kevin 2012-09-14 22:19

Why isn't this compiling?

import java.lang.String;
public class Song{
public static void main(String[] args) {
    firstTwoLines();
    lastLine();
    firstTwoLines();
    dayTwo();
    lastLine();
    firstTwoLines();
    dayThree();
    lastLine();
    firstTwoLines();
    dayFour();
    lastLine();
    firstTwoLines();
    dayFive();
    lastLine();
    firstTwoLines();
    daySix();
    lastLine();
    firstTwoLines();
    daySeven();
    lastLine();
    firstTwoLines();
    dayEight();
    lastLine();
    firstTwoLines();
    dayNine();
    lastLine();
    firstTwoLines();
    dayTen();
    lastLine();
    firstTwoLines();
    dayEleven();
    lastLine();
    firstTwoLines();
    dayTwelve();
    lastLine();
    }

    public static void firstTwoLines(String[] args){
    system.out.println("On the first day of Christmas,\nMy true love sent to me");
    }

    public static void lastLine(String[] args){
    system.out.println("A patridge in a pear tree.\n");
    }

    public static void dayTwo(String[] args){
    system.out.println("Two turtle doves and");
    }

    public static void dayThree(String[] args){
    system.out.println("Three french Hens,\nTwo turtle doves and");
    }   

    public static void dayFour(String[] args){
    system.out.println("Four calling birds,\nThree french Hens,\nTwo turtle doves and");
    }   

    public static void dayFive(String[] args){
    system.out.println("Five golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }   

    public static void daySix(String[] args){
    system.out.println("Six geese a-laying,\nFive golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }
   
    public static void daySeven(String[] args){
    system.out.println("Seven swans a-swimming,\nSix geese a-laying,\nFive golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }   

    public static void dayEight(String[] args){
    system.out.println("Eight maids a-milking,\nSeven swans a-swimming,\nSix geese a-laying,\nFive golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }   

    public static void dayNine(String[] args){
    system.out.println("Nine ladies dancing,\nEight maids a-milking,\nSeven swans a-swimming,\nSix geese a-laying,\nFive golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }   

    public static void dayTen(String[] args){
    system.out.println("Ten lords a-leaping,\nNine ladies dancing,\nEight maids a-milking,\nSeven swans a-swimming,\nSix geese a-laying,\nFive golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }   

    public static void dayEleven(String[] args){
    system.out.println("Eleven pipers piping,\nTen lords a-leaping,\nNine ladies dancing,\nEight maids a-milking,\nSeven swans a-swimming,\nSix geese a-laying,\nFive golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }   

    public static void dayTwelve(String[] args){
    system.out.println("Twelve drummers drumming,\nEleven pipers piping,\nTen lords a-leaping,\nNine ladies dancing,\nEight maids a-milking,\nSeven swans a-swimming,\nSix geese a-laying,\nFive golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }   
}

Name: Anonymous 2012-09-14 22:42

Disgusting

Name: Anonymous 2012-09-14 22:49

Please help :(
I know nothing.

Name: Anonymous 2012-09-14 22:58

Nigger programming

Name: Anonymous 2012-09-14 23:50

put some loops in there. noone will want to read this the way it is

Name: Anonymous 2012-09-15 0:02

>>1
That's some ENTERPRISE QUALITY code

Name: Anonymous 2012-09-15 0:06

You should probably put all the text in an array, and just run an incrementing loop to print all contents up to the current run of the loop (use a counter variable). That would cut your code down 2/3. I don't know java, but it would probably be something like this:

//This code is probably wrong
public class Song {
   public static void main(String[] args) {
       String[] verses = new String[12];
       verses[0] = "A partridge in a pair tree\n";
       verses[1] = "Two Turtle Doves\n";
       ...
       verses[11] = "Twelve drummers drumming\n";
       int count = 0
       while(count < 12) {
           System.out.println(verses[count]);
           count++;
       }
   }
}


That won't print out every thing the right way each time, but i don't feel like figuring it out right now...

Name: Anonymous 2012-09-15 0:20

That was Java quality!

Name: Senjougahara Hitagi !p8eYCadcMo 2012-09-15 0:54

>function takes in an argument
>system.out.println()
>complain when it doesn't work

wat

>fixed code
http://pastebin.com/CnhpFLZ3

Also your code sucks and you should feel bad for not using loops:
http://pastebin.com/zVqQYnqS

Name: Anonymous 2012-09-15 1:08

This is so much easier in python
days = [
        "A patridge in a pear tree!",
        "Two turtle doves and",
        "Three french Hens,",
        "Four calling birds,",
        "Five golden rings,",
        "Six geese a-laying,",
        "Seven swans a-swimming,",
        "Eight maids a-milking,",
        "Five golden rings,",
        "Nine ladies dancing,",
        "Ten lords a-leaping,",
        "Eleven pipers piping,",
        "Twelve drummers drumming,"
]
x = 0
while x < 12:
        y = x
        while y >= 0:
                print(days[y])
                y-=1
        x+=1

Name: Python 2012-09-15 1:14

Yes, and computers are getting so fast it will not matter whether you use C/python/not lisp Ever, python is god.

Name: Anonymous 2012-09-15 1:32

>>11
lol, keep telling yourself that.

Name: Em 2012-09-15 1:40

lol says HURR DURR I NEED MA EXTA MIKROSEKONZ!

Name: Anonymous 2012-09-15 1:55

>>11
Only applies if you write nothing but toy programs

Name: Anonymous 2012-09-15 2:48

Added code tags. Remember to do this next time, OP.


import java.lang.String;
public class Song{
public static void main(String[] args) {
    firstTwoLines();
    lastLine();
    firstTwoLines();
    dayTwo();
    lastLine();
    firstTwoLines();
    dayThree();
    lastLine();
    firstTwoLines();
    dayFour();
    lastLine();
    firstTwoLines();
    dayFive();
    lastLine();
    firstTwoLines();
    daySix();
    lastLine();
    firstTwoLines();
    daySeven();
    lastLine();
    firstTwoLines();
    dayEight();
    lastLine();
    firstTwoLines();
    dayNine();
    lastLine();
    firstTwoLines();
    dayTen();
    lastLine();
    firstTwoLines();
    dayEleven();
    lastLine();
    firstTwoLines();
    dayTwelve();
    lastLine();
    }

    public static void firstTwoLines(String[] args){
    system.out.println("On the first day of Christmas,\nMy true love sent to me");
    }

    public static void lastLine(String[] args){
    system.out.println("A patridge in a pear tree.\n");
    }

    public static void dayTwo(String[] args){
    system.out.println("Two turtle doves and");
    }

    public static void dayThree(String[] args){
    system.out.println("Three french Hens,\nTwo turtle doves and");
    }  

    public static void dayFour(String[] args){
    system.out.println("Four calling birds,\nThree french Hens,\nTwo turtle doves and");
    }  

    public static void dayFive(String[] args){
    system.out.println("Five golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }  

    public static void daySix(String[] args){
    system.out.println("Six geese a-laying,\nFive golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }
  
    public static void daySeven(String[] args){
    system.out.println("Seven swans a-swimming,\nSix geese a-laying,\nFive golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }  

    public static void dayEight(String[] args){
    system.out.println("Eight maids a-milking,\nSeven swans a-swimming,\nSix geese a-laying,\nFive golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }  

    public static void dayNine(String[] args){
    system.out.println("Nine ladies dancing,\nEight maids a-milking,\nSeven swans a-swimming,\nSix geese a-laying,\nFive golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }  

    public static void dayTen(String[] args){
    system.out.println("Ten lords a-leaping,\nNine ladies dancing,\nEight maids a-milking,\nSeven swans a-swimming,\nSix geese a-laying,\nFive golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }  

    public static void dayEleven(String[] args){
    system.out.println("Eleven pipers piping,\nTen lords a-leaping,\nNine ladies dancing,\nEight maids a-milking,\nSeven swans a-swimming,\nSix geese a-laying,\nFive golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }  

    public static void dayTwelve(String[] args){
    system.out.println("Twelve drummers drumming,\nEleven pipers piping,\nTen lords a-leaping,\nNine ladies dancing,\nEight maids a-milking,\nSeven swans a-swimming,\nSix geese a-laying,\nFive golden rings,\nFour calling birds,\nThree french Hens,\nTwo turtle doves and");
    }  
}

Name: Anonymous 2012-09-15 4:07

>>10

Incremental while loops considered unpythonic.

for x in range(12):
    for verse in days[x::-1]:
        print verse
    print

Name: Em 2012-09-15 17:41

Yeah, I usually don't write anything major, but eventually I will have to use one of these horrible languages.

Name: Anonymous 2012-09-15 19:27

>>17
Then you're better off Doing It RightTM and just learning LISP and always using that, even when you have to "use" other things because you can just write functions that generate the code in pigdisgusting latin for you.

Don't change these.
Name: Email:
Entire Thread Thread List