Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 145
  • Last Modified:

enumerate decimals

I'm wondering if I'm understanding this correctly.

If I've got a movie admission class with the following enum

Public Enum AgeGroup
  Toddler = 0.00
  Student = 1.50
  Military = 1.00
  Adult = 3.00
  Senior = 1.00
End Enum

I get an error since option stict is on.  Other than turning it off, how would I set this up?
The error is ...implicit conversions from double to integer are disallowed...
0
sirbounty
Asked:
sirbounty
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Enums can't hold decimals...

From here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemenumclasstopic.asp

    "An Enum is a named constant whose underlying type is any integral type except Char."

If you really want to use an Enum then I guess you could store the values like 150, 100, or 300 and then divide them by 100 to get the actual value.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now