floppyspace's Profile User Rating: -----

Reputation: 25 Craftsman
Group:
Active Members
Active Posts:
184 (0.15 per day)
Joined:
04-February 10
Profile Views:
2,094
Last Active:
User is offline Apr 15 2013 06:45 AM
Currently:
Offline

Previous Fields

Country:
AU
OS Preference:
Who Cares
Favorite Browser:
Chrome
Favorite Processor:
Who Cares
Favorite Gaming Platform:
PC
Your Car:
Ford
Dream Kudos:
0
Icon   floppyspace always learning something...

Posts I've Made

  1. In Topic: Trimming and Parsing the input?

    Posted 27 Mar 2013

    View PostGungnir, on 27 March 2013 - 03:30 PM, said:

    Quote

    you can not convert a double to a string


    Yes, you can:
    	while((count < SIZE)){    
    	   System.out.print("Grade " + (++count) + ": ");
    	   gradesEntered = bf.readLine( ) ;
    	    
    	   if(gradesEntered.length() < 1){
    	      System.out.println(String.valueOf(total));
                  break; 
    	   }
    	   total = total + Double.parseDouble(gradesEntered);
            }
    
    


    I was speaking to relation to it been used in this way....

    gradesEntered = Double.parseDouble(bf.readLine( )) ;
    
  2. In Topic: Trimming and Parsing the input?

    Posted 27 Mar 2013

    perhaps I should clarify what was meant by my post

    grades entered has been used as a string

    gradesEntered = Double.parseDouble(bf.readLine( )) ;
    


    you can not convert a double to a string

    if something similar to this is used

          while((count < SIZE) && (exit == false)){     
             System.out.print("Grade " + (++count) + ": ");
             gradesEntered = bf.readLine( ) ;
             
             total = total + Double.parseDouble(gradesEntered);
             
             if(gradesEntered.length() < 1){
                System.out.println(total);
                exit = true;   
             }
    


    it will throw an NumberFormatException-empty string (true the exception could be handled), if the user does not enter anything and just presses enter past an input line (which I interpret as how MissHaller wants to stop the program from running).

    if(gradesEntered.length() < 1){
                System.out.println(total);
                exit = true;   
             }
             else
             {
                total = total + Double.parseDouble(gradesEntered);
             }
    


    this will stop the error from showing up.

    as for the while running once I am incorrect.
  3. In Topic: java assignment trying to find the surface area of the exterior

    Posted 26 Mar 2013

    View Postdurianruntuh, on 27 March 2013 - 02:31 PM, said:

    I am a beginner at programming in java and have run into a lot of trouble trying to write the program).


    post what you have done, effort gets rewarded with answers.
  4. In Topic: Trimming and Parsing the input?

    Posted 26 Mar 2013

    As Gungnir says,

    But you will need to so something like

    if(gradesEntered.length() < 1){
                exit = true;   
             }
             else
             {
                total = total + Double.parseDouble(gradesEntered);
             }
    
    


    so you do not get an error when you parse the input and also note because it is a while loop it will always perform once so your output may not be as you desire but check it anyway.

    gl
  5. In Topic: Loop to display asterisks

    Posted 26 Mar 2013

    as drakethedragon says it is one line

    for(int k = 6; k >=1; k--)
    


    needs to be changed to

    for(int k = 0; k < j; k++)
    

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
some page on the web
Interests:
Reading,Gardening,Computers,Cooking,Soccer,Anything tech.
Years Programming:
2
Programming Languages:
Learner of all languages.
Current main interest PHP,Java,Web Development

Anything and everything.

Contact Information

E-mail:
Click here to e-mail me

Friends

Comments

Page 1 of 1
  1. Photo

    David W Icon

    07 Jun 2012 - 01:38
    Like your attitude, my friend.
  2. Photo

    floppyspace Icon

    12 Jan 2012 - 21:04
    floppyspace has no profile comments yet. Why not say hello?
    Hello
Page 1 of 1