Hi, I am also very keen if Vitor enquiry can be accomplished. I try to
do simple coding first before progressing to Vitor's problem.

Please kindly advice if I can get the subject name to pass to "enum
passingScore". I try to achieve this because I find myself duplicating
the subject name. Thanks in advance.

import java.util.* ;
public class work{
        public enum subject{Science, Math, Literature, History}
        enum passingScore{
                Science(55), Math(60), Literature(80), History(40) ;
                int score ;
                passingScore(int myScore) {
                        score=myScore ;
                }
                int getScore() {
                        return score ;
                }
        }

        public static void main(String args[]) {
                passingScore marks = Enum.valueOf(passingScore.class, "Math") ;
                System.out.println("The passing score for " + marks.Math + " is 
" +
marks.getScore() ) ;

        }
}

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to