Originally posted by Ravi Srinivas:
Would just like to add that declaring constants such as DollarToEuro = 1.234 at the beginning of your class might be better.
Originally posted by Steven Bell:
I would just add that anytime I see more than a half a dozen lines inside a
'public static void main(String args)'
method I cringe and die a bit inside.
Ofcourse both the Gifts.class and ProgramProject3.class are in the same directory...
Originally posted by Ryan McGuire:
However, if you're saying some of the code in this particular main() could be sucked out and put into a displayMenu() and performAction() methods, then I basically agree. BUT... the menu and the actions have to know about each other because they have to share the input-char-to-action correspondence. If you take the menu displaying and action taking code out of main(), there isn't a whole lot left.
This has to be considered on a case-by-case basis. (I hate how often I have to say that. But I guess that what keeps me employed. )
making a contructor private means noboby outside your class can create an object of that type
When I change the Instance Variable and Constructor variable to private... I get the below compile error when I compile the ProgramProject3.java..???
the common practice is to mark vars private and then supply public accessors:
I was under the impression that if I use private variables, I can still define a public method to display the private variables data?