• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Say 4b just got harder...

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thought I'd share a nit that just got picked in my submission of Say-4b. I had used the following line of code:
long divisor = (long)( Math.pow( 10 , i ) ) ;
And got the following comment regarding that code:

there is a purpose to this assignment that is covered by doing this without external methods. Please do this assignment with no outside classes.


No outside classes? Well, upon viewing my code, I noticed that I also use the System class (System.out.print), the Long class (Long.parseLong), and the String class.
Whew! This is going to be tough rewriting my code to avoid all those outside classes.
(Marilyn, am I correct in assuming that it's just the Math class that you want me to avoid using here?)

[This message has been edited by Elisabeth Van (edited March 17, 2001).]
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Elisabeth,
It must be just the Math class; because I used String and Long without getting the same message.
Jane
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep. Just the Math class. I thought about that after I sent it, but there's no way to bring email back.
System, String, Long, and Integer are fine.

[This message has been edited by Marilyn deQueiroz (edited March 17, 2001).]
 
Elisabeth Van
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for clearing that up. Hope you could notice the tongue-in-cheek on that one. The "no outside classes" just struck me as funny.
(But doggone it, I thought I was going to get that assignment on the first try!)
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all...
I'm working on Say(b) but now I am wondering if I should be using long variables? I was thinking it could be done sticking with int. It is always nine hundred and ninety-nine something so I thought the 999,999,999,999 could be divided into four packages of three numeral strings to be processed and never have to use long.
Also, I'm only using one method plus the main method which is a series of nested 1f-then qualifiers. I know the solution has four methods, should I plan on having four methods too? Thanks...
~Ed
 
Marilyn de Queiroz
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ed Byrnes:
I'm working on Say(b) but now I am wondering if I should be using long variables?


You don't necessarily need long variables.


I know the solution has four methods, should I plan on having four methods too?


When you actually have two pieces of code that need the same thing, THEN you create the method so it can be used by both.
 
Ed Byrnes
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cool and thanks!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic