Coding: Feliz año

Resulta que me pongo a escribir un email a mis amistades para saludarlos y desearles lo mejor en este nuevo año y de repente se me ocurre hacerles un script en PHP (para ser medio creativo), considerando que varios de mis amigos son programadores o aficionados a la programación como yo, esto es lo que sucedió:

Aquí esta mi humilde script en PHP:


<?php
/*Copyright 2007-2008, su amigo: Enrique Monge*/
$year = date(Y);
if ($year == 2008){
print "Feliz año 2008 para todos!";
} else {
print "Sigan bebiendo...";
}
/*Que Dios (el programador perfecto de la creación)
los bendiga hoy y siempre*/
?>

Luego viene el joven xtecuan y gentilmente me envía su saludo en Java:


package com.xtesoft.newyear;
import java.io.Serializable;
public class NewYear implements Serializable{
public static final int DEFAULT_NEW_YEAR=2008;
public static final String UNKNOWN_USER="AMIGO";
public static final String NEW_YEAR_MESSAGE="Feliz Annio";
public static final String NEW_YEAR_MSG_FINAL=" que Dios lo bendiga!!!";
private String user;
private String year;
public NewYear(){
this.setUser(UNKNOWN_USER);
this.setYear(DEFAULT_NEW_YEAR);
}
public NewYear(String user, int year){
this.setUser(user);
this.setYear(year);
}
public void setUser(String user){
this.user = user;
}
public String getUser(){
return this.user;
}
public void setYear(int year){
this.year = year;
}
public int getYear(){
return this.year;
}
public String generateMessage(){
return NEW_YEAR_MESSAGE+" "+this.getYear()+" "+this.getUser()+" "+NEW_YEAR_MSG_FINAL+"\n";
}
public static final void main(String[] args){
NewYear newYear = new NewYear("Enrique Monge", 2008);
System.out.println(myYear().generateMessage());

Al cabo de unos minutos Esteban Mayorga, envía su saludo en Perl:


#!/usr/bin/perl
my $old_year = system(date +%Y);
my $new_year = "2008";
while( $old_year eq $new_year) {
print "Sigan bebiendo\n";
return 1;
}
print "Feliz año!!\n";

Pero como es usual, el tal Mayorga ya se encontraba en estado de ebriedad y al cabo de unos segundos se percató de un error en el código y envió su parche:


@3,1 4,2@
my $new_year = "2008";
- while($old_year eq $new_year) {
+ while($old_year ne $new_year) {
print "Sigan bebiendo\n";

E igualmente, saludos a todos!



11 views shared on this article. Join in...

  1. Fernando (Chero07) says:

    Dos cosas diré:

    1. Geeks xDDD
    2. Feliz 2008.

  2. sir woody says:

    Feliz 2008 Fernando :) !

  3. Snipe says:

    Por alguna razón que no comprendo, me he matado de la risa con este post. xD

    Feliz año.

  4. sir woody says:

    Feliz año Snipe! :P

  5. En GW-BASIC (WTF!!!!!)

    10 Dim fecha$,mensaje$, mensaje2$
    20 fecha$=date$
    30 mensaje$ = “Feliz Año!!”
    40 mensaje2$ = Sigan bebiendo”
    30 While fecha$ > “01/01/2008″
    40 print mensaje2$
    50 Wend
    60 Print mensaje$
    70 End

    Saludos a todos :)

  6. David says:

    Vale veinte ni para año nuevo se deja la programación :D

  7. tato says:

    Yo estaba alli!! y doy fe que estaba a pija!! xDD

    Feliz Año!!

  8. krypto84sv says:

    Pues yo te traduzco tu codigo de php a C#

    using System;
    using linux.org.sv;

    namespace linux.org.sv
    {

    public class Programador
    {
    private int nuevoAnyo;
    private int AnyoActual;
    private string accion;

    public string Accion {
    get { return this.accion; }
    }

    public Programador()
    {
    this.nuevoAnyo=2008;
    this.AnyoActual=DateTime.Now.Year;
    }

    public void QueHago() {
    if (this.AnyoActual==this.nuevoAnyo)
    this.accion=”Feliz año para todos….!!”;
    else
    this.accion=”Que sigan bebiendo…!!”;
    }

    public static void Main(string[] args) {
    Programador BloguerLinuxOrgSv=new Programador();
    BloguerLinuxOrgSv.QueHago();
    Console.WriteLine(BloguerLinuxOrgSv.Accion);
    }
    }
    }

    No se te olvide compilarlo con mono

    $ mcs Programador.cs
    $ mono Programador.exe

  9. ajnajajajaja ke interesante esto…y las respuestas tambien XD XD

  10. el-visitador says:

    10 REM INFINITE LOOP
    20 PRINT “EL SALUDO WOODIESCO ES EL MÁS GEEK QUE HE RECIBIDO JAMÁS”
    30 GOTO 20

Leave a Reply

Your email address will not be published. Required fields are marked *

*


four − 3 =

Comment

You may use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>