oha055's Profile User Rating: -----

Reputation: 39 Craftsman
Group:
Active Members
Active Posts:
229 (0.15 per day)
Joined:
02-February 09
Profile Views:
2,588
Last Active:
User is offline May 06 2013 12:08 PM
Currently:
Offline

Previous Fields

Country:
NO
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
Nintendo
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   oha055 has not set their status

Posts I've Made

  1. In Topic: Reading time name...

    Posted 19 Apr 2013

    When you return from a method, code beneath the return stement is diregarded. That is why you only get hours. Rather than returning the strings directly, you should store them in a variable, and then at the end of the method return this variable.

    String hoursAndMins = "";

    if(hours == 1) hoursAndMins += "one";

    ...


    if(mins == 30) hoursAndMins += "thirty";


    ...

    return hoursAndMins;
  2. In Topic: Need help with recursive method

    Posted 19 Apr 2013

    Finally got it working! :) damn.. that took some time.

    (Since the assignment required me to use only a single function, I couldn't use jons answer.)

    For future reference, here is what I did:
    	public static int rec(int n) {
    		if(n == 0) return 3;
    		return rec(n-1)*rec(n-1);
    	}
    
    
  3. In Topic: Need help with recursive method

    Posted 17 Apr 2013

    Thanks again! :) very much appreciated!

    One last question though, would my initial solution work in theory? Given unlimited resources. The reason I'm asking is that the assignment was to write pseudocode on paper. (discrete mathematics-course)
  4. In Topic: Need help with recursive method

    Posted 17 Apr 2013

    Thanks for your reply jon! :) Cant do 9^n though, since what I am computing isnt (3^2)^n but (3)^(2)^(n)
  5. In Topic: Cannot seem to get the JButton "exit" to work

    Posted 20 Mar 2013

    Your problem is here:

    else //code to execute if the user clicks exit
    	            {//open else
    	                try
    	                {
    	                    output.close();
    	                }
    	                catch(IOException c)
    	                {
    	                    System.exit(0);
    	                }
    	            }//close else
    
    


    With your try/catch block you are telling the program to only exit if there is an I/O exception. Why? Just remove the try/catch and you should be fine :)

My Information

Member Title:
D.I.C Head
Age:
26 years old
Birthday:
January 20, 1987
Gender:
Location:
Voss/Bergen, Norway
Interests:
computers, music, photography, beer
Full Name:
Øyvind Hauge
Years Programming:
5
Programming Languages:
PROFICIENT: Java, PHP
OTHER: jQuery/JavaScript, CSS, HTML5, XML, Prolog
CURRENTLY LEARNING: Android, C++, Python

Contact Information

E-mail:
Click here to e-mail me
Website URL:
Website URL  http://www.ohauge.net
Facebook:
http://www.facebook.com/oyvindshauge

Friends

Comments

oha055 has no profile comments yet. Why not say hello?