Pergunta

I need help for a work I got at school... I'm trying to make a enum or more than one that will have in memory the information of the number of days in a month, the name of the month, and the number of the month.

Also, my teach said that all the information MUST be in my code... No database or other stuff like that. -_-

Exp:

 public enum list
        {
          month = "nbdays" && "montnumber" && "otherinformation";
          //Total bad syntaxe I know its just an exemple of how id like it to work.
        }

Another Exp:

public enum list
    {
      enum month
      {
        numdays = blabla
        monthnumber = bleble
        otherinfo = blublu
      }
    }

NOTE: I don't really want to use a array because it not ergonomical X_X but if you think its the best solution I will go for it.

Foi útil?

Solução

  1. If can build the month details during every run: You can create a class called Month with 3 fields name, position, noOfDays. Then maintain the instances of the class in a list(12 elements).
  2. You can also maintain a property file with this information and make use of it when build the objects as mentioned in step 1.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top