Results 1 to 9 of 9

Thread: More Eclipse Java coding... I was bored, okay?

  1. #1
    Mesmerale

    Default More Eclipse Java coding... I was bored, okay?

    So I'm in my Computer Science class, and everyone is correcting the tests we just took, and I've already finished...

    Now we haven't had any coding projects in this class for awhile, and I really wanted to code something, so I went to the ACSL (American Computer Science League) website and looked at some past projects they had, and chose this one..

    From 1996-1997, the Intermediate Division of Contest #1..

    "The Biggest" ( If you can't see it, I dunno what to tell you. >.> )

    So yeah, pretty awesome, as you can see. ^_^ And it was hard as hell to figure out how to code it, but after a few minutes, I figured something out.

    I hope it's somewhat decent...

  2. #2
    Mesmerale

    Default

    Last edited by Mesmerale; 23-Apr-2009 at 02:40.

  3. #3
    Mesmerale

    Default

    Last edited by Mesmerale; 23-Apr-2009 at 02:40.

  4. #4
    Mesmerale

    Default

    Whoot! Finally done editing all that stuff!

    Apart from the quality of the code itself: How's it look? Are the forums "Indenting" functions being used to their fullest, d'ya think?

    I think it looks nice. ^_^

  5. #5

    Default

    Ooh, cool. I shall try to come up with a python program to solve it.

  6. #6
    Mesmerale

    Default



    Quote Originally Posted by mzkkbprmt View Post
    Ooh, cool. I shall try to come up with a python program to solve it.
    Whoot!

    I'm gonna do the senior division now, and then maybe the junior 'cause I love doing everything completely. (Depending on what it is. ^_^)

  7. #7

    Default

    Haha, I'm in an intro to programming class where the main language we use is Java. The only programs we've made so far are short, small programs that check to see if a number is either prime or composite Most of what you have there is still foreign to me.

  8. #8
    Mesmerale

    Default



    Quote Originally Posted by Kams View Post
    Haha, I'm in an intro to programming class where the main language we use is Java. The only programs we've made so far are short, small programs that check to see if a number is either prime or composite Most of what you have there is still foreign to me.
    I am going to give you the most important and helpful advice that you'll ever hear...

    Read whatever textbook you are given! Cover to cover!

    You will learn so much before it's taught to you, and you'll probably understand how to use it.

    There will be example programs that will show you how something works, and how to use it.

    You will be able to use methods that the people around you haven't even heard of yet, and it will help you a lot.

    Read. That. Book.

    And one more thing. For the love of god, remember the semicolon.

  9. #9

    Default

    Oh yeah, I've been able to get ahead a of the class a little quicker because I read the text book in advance. Here's a little program I made that'll determine the day of the week for any date in the 20th century.

    Code:
    public class TrivialApplication 
    {
    
    	public static void main(String args[]) 
    	{	
    		
    		EasyReader console = new EasyReader();
    		
    		// Do-loop loops the program
    		int answer=1;	
    		do	
    		{
    			// Program allows the user to enter a date
    			System.out.print("\nMonth=		");
    			int month=console.readInt();
    			System.out.print("\nDay=		");
    			int day=console.readInt();
    			System.out.print("\nYear=		");
    			int year=console.readInt();
    			
    			// Variables that affect 'total'
    			int yeartrunc=year-1900;
    			int truncdiv=yeartrunc/4;
    			int total=yeartrunc+day+truncdiv;
    		
    			// If-statements add to 'total' depending on the month entered
    			if (month==1)
    				total=total+1;
    			else if (month==2)
    				total=total+4;	
    			else if (month==3)
    				total=total+4;
    			else if (month==4)
    				total=total+0;
    			else if (month==5)
    				total=total+2;
    			else if (month==6)
    				total=total+5;
    			else if (month==7)
    				total=total+0;
    			else if (month==8)
    				total=total+3;
    			else if (month==9)
    				total=total+6;
    			else if (month==10)
    				total=total+1;
    			else if (month==11)
    				total=total+4;
    			else if (month==12)
    				total=total+6;
    			
    			if (year%4==0&&(month==1||month==2))
    				total=total-1;
    			
    			// Program outputs the day on which the date entered falls on
    			if (total%7==1)
    				System.out.println("\nThis date falls on a Sunday");
    			else if (total%7==2)
    				System.out.println("\nThis date falls on a Monday");
    			else if (total%7==3)
    				System.out.println("\nThis date falls on a Tuesday");
    			else if (total%7==4)
    				System.out.println("\nThis date falls on a Wednesday");
    			else if (total%7==5)
    				System.out.println("\nThis date falls on a Thursday");
    			else if (total%7==6)
    				System.out.println("\nThis date falls on a Friday");
    			else if (total%7==0)
    				System.out.println("\nThis date falls on a Saturday");
    			
    			// Program asks the user whether or not they would like to enter another date
    			System.out.print("\nWould you like to enter another date? (Yes-1 No-2): ");
    				answer=console.readInt();
    		
    		}while (answer==1);
    	}
    }

Similar Threads

  1. Replies: 6
    Last Post: 25-Apr-2009, 23:51
  2. Java code! Yay! Criticize!
    By Mesmerale in forum Computers & Gaming
    Replies: 12
    Last Post: 14-Feb-2009, 05:00
  3. Learning java
    By Mornavial in forum Computers & Gaming
    Replies: 14
    Last Post: 06-May-2008, 00:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
ADISC.org - the Adult Baby / Diaper Lover / Incontinence Support Community.
ADISC.org is designed to be viewed in Firefox, with a resolution of at least 1280 x 1024.