Class design question: Can you have an enum of class objects?

Hi, thank you for reading this post!
We all know that an enum represents a set of constants, but sometimes a class has a restricted set of values as
well. My question is can we have an enum of objects.
Example:
We have a class named Coin
   A coin with a monetary value.
public class Coin implements Measurable
   private double value;
   private String name;
   public Coin(double aValue, String aName)
      value = aValue;
      name = aName;
   public double getValue()
      return value;
   public String getName()
      return name;
   public double getMeasure()
      return value;
}We all know that a coin has a set of values "Dollar" = 1.00, "Quarter" = 0.25, "Dime" = 0.10, "Nickel" = 0.05, and
"Penny" = 0.01.
Can we have an enum of Coins with Coin as a class at the same time?
If yes, how do we do this?
Thank you in advance for your help!
Eric

Maybe you want something like this:
public enum Coin implements Measurable {
     DOLLAR(1.00, "Dollar"),
     QUARTER(0.25, "Quarter"),
     DIME(0.10, "Dime"),
     NICKEL(0.05, "Nickel"),
     PENNY(0.01, "Penny")
     private double value;
     private String name;
     Coin(double aValue, String aName)
          value = aValue;
          name = aName;
     public double getValue()
          return value;
     public String getName()
          return name;
     public double getMeasure()
          return value;
}

Similar Messages

  • How much design control can you have with FormsCentral?

    Hi there,
    Our company's forms have a defined look, initially created in LiveCycle.  I am willing to remake every last one of our many forms in order to get them online and mobile-compatible, but I'm concerned about maintaining our look.  It isn't complicated, but I'd like to use our colors, logo, etc.
    Can someone recommend documentation or a set of samples that will show me what the design parameters are for FormsCentral?
    Many thanks,
    Laura

    You can check out our templates here to get an idea: https://www.acrobat.com/formscentral/en/templates/web-forms-builder.html
    Also, try out our free account to see if it works for you before purchasing.
    Randy

  • I have a question can you please add so the iphone also have 5 icon dock like the iPad have it would make my day easy as h..:) maby in the next update? What do you think?

    I have a question can you please add so the iphone also have 5 icon dock like the iPad have it would make my day easy as h..:) maby in the next update? What do you think? What do everyone think?

    I have a question can you please add so the iphone also have 5 icon dock like the iPad have it would make my day easy as h..:) maby in the next update? What do you think? What do everyone think?

  • HT4990 how can you reset your security questions if you have forgot them

    How can you reset your security questions if you have forgot them.?

    You may find solutions if you look under More Like This at the right of this page. If not, this forum is for questions from those managing sites on iTunes U, Apple's service for colleges and universities to post educational material in the iTunes Store and hence not the best place to get assistance with this problem. You'll be most likely to get additional help with this issue if you ask in the general iTunes forums where this question has been asked and answered in a number of other threads.
    Regards.
    Message was edited by: varjak paw

  • I'm getting a new computer, I will have to download Firefox again, My question can you save your add-ons? I have reminder Firefox and I want to know if I should save the info?

    I'm getting a new computer, I will have to download Firefox again, My question can you save your add-ons? I have reminder Firefox and I want to know if I should save the info?

    You can use this extension to make a backup of the current Firefox profile folder:
    *FEBE (Firefox Extension Backup Extension): https://addons.mozilla.org/firefox/addon/febe/

  • Can you have multiple bleed allowances (along with the multiple page sizes) in InDesign CS5?

    Hi there,
    I'm new to InDesign and have a question about documents with mixed page sizes in CS5.  I'm preparing an illustrated book for print and was hoping to be able to contain all the pages (including the covers) in one document.  My basic setup is 140 mm x 210 mm with a 3 mm bleed on each side.  I've managed to add the different cover page (146 mm x 216 mm) and spine (10 mm) dimensions easily enough, but can you have multiple bleed specifications too?  The bleed allowance I need for the case layout is 15 mm.  I've scoured InDesign and the net, but can't find any information about this anywhere.  It would seem rather silly to be able to have multiple page sizes in your document without being able to change the bleed allowance too.  Here's hoping it's possible!  Any help with this would be greatly appreciated. 
    Thank you!
    Alexandria

    make sure what your printer means ie: Page size + 6mm spine bulk + 15mm bleed.
    and design acordingly
    G..

  • In BPM sync/async Step , can you have different message schema?

    Scenario:
    File to XI to BPM to SOAP to RFC
    In order to trigger the  webservice , I use  a dummy file which will be polled at a certain frequency- once in 30 minutes in Test mode - this will call the Webservice. The answer of webservice is sent to RFC Async.
    so these  are the Repository objects I created :
    1. File  Outbound Async Message Interface- Output Message (File_Request_MT)
    2.File Abstract Message Interface-Output Message (File_Request_MT)
    3.Async/ sync bridge Abstract interface to call the Webservice
    4 Webservice Inbound Sync Message interface-  with both input and output message
    5.RFC Inbound Async message interface- input message (RFC_Request)
    6 RFC Abstract Async Message interface-input message (RFC_Request)
    BPM
    a) Receive step  which uses the  the object 2.
    b) Sync send which uses object 3
    c) Send  step which uses Object 5
    I am using a BPM to Receive the file data/ "request " by using the File abstract message interface
    Then use the  the object  3 to call the webservice in BPM .
    My question is on this step
    Can I have for  the abstract Interface(Object 3) the Request message  as  File_Request_MT and
    response message as (RFC_Request) ?
    I  use a message mapping  to map Input and Ouput message of Object 3 with Object 4.
    Thanks for  your insight

    Raj,
    Thanks for the feedback , but I have  a question regarding your reply
    Interface Objects
    Object 1: File_Request_Abs
    Object 2: Soap_Response_Abs
    Object 3:Soap_Abs_Synch
    Output Message:File_Request_Abs
    Input Message:Soap_Response_Abs
    Object 4:Rfc_Request_Abs
    The question is  about
    a)SOAP_RESPONSE_ABS : could you please tell me why  do we need an abstract interface -SOAP_RESPONSE_ABS?
    I created a message type MT_SOAP_RESPONSE and used that in the BPM sync Send step as the Input message.
    b)Soap_Abs_Synch- I am using message types
    MT_File_request and MT_SOAP_Response From your reponse, it looks like you are suggesting to use
    Abstract Interfaces as Output message and Input Message, am I correct? Could you please tell me whether this has advantages over using message types MT_file_request and MT_soap_reponse? I haven't used Abstract interfaces  before as Input message and output message; infact, I wasn't even aware that it can be. Please confirm that it is possible. Thank you for increasing my knowledge !!!
    These are the Objects I created
    Message Type :
    a) MT_Filerequest
    b) MT_SOAPresponse
    Message Interface
    a)MI_Filerequest_out_async -
    Output message
    Mess. type MT_filerequst
    b)MI_filerequest_async_abs-
    Mess. type MT_filerequst 
    Used
    i) used for BPM receiver step- container definition
    ii) receiver determination
    c)MI_webservice_sync_in - This is created from External definition
    d)MI_webservice_sync_abs- 
    Input message  - MT_soapresponse
    Output message- MT_fierequest
    Used:
    i) used for BPM sync send step ,
    ii)Interface mapping between  MI_Webservice_sync_in and MI_webservice_sync_abs
    iii)Container element-SOAP_response
    e) MI_RFC_async_out
    Input message
    RFC_Request(This is imported from RFC definition)
    g) MI_RFC_async_abs
    Input message
    RFC_Request(This is imported from RFC definition)
    Mapping
    Message mapping
    i)Filerequest_TO_SOAPrequest
    Source: MT_Filerequest
    Target: SOAPrequest(Got from External definition)
    ii)SOAPresponse_TO_BPM_response
      Source : SOAPresponse(got from External definition)
    Target :   MT_SOAPresponse
    Interface Mapping
    i)IM_BPM_TO_SOAP
    Source Interface : MI_webservice_sync_abs
    Target :MI_webservice_sync_in
    uses following message mapping
    Request : filerequest_TO_SOAPrequest
    Response:SOAPresponse_TO_BPM_response
    BPM container element
    i)Receiver_container  TYPE MI_Filerequest_out_async
    ii)SOAP Responsecontainer TYPE MI_webservice_sync_abs
    iii)RFC_Request_container TYPE MI_RFC_async_abs
    BPM  flow
    Receive---->Send Synch-->Transformation----->Send Asynch
    Receive -
    > receiver_container
    Send Synch -
    > receiver_container(Request Message), Soap_response_container(Response Message)
    Transformation -
    > Source(Soap_response_container), Target(RFC_request_container)
    Send Asynch -
    > RFC_request_container
    Thanks for your help!!!

  • Can you have two Enterprise CA on the same AD Domain at the same time

    Hello
    Can someone please help me with the following question
    If I have a Windows 2003 R2 Enterprise Root CA on the AD Domain can I also Add a separate Windows 2012 R2 Enterprise Root CA to the same domain.
    We do not use Autoenrollment on the existing 2003 R2 CA.
    Network guys want to introduce a Cisco BYOD (Bring Your Own Devise) solution using Cisco ISE (Identity Services Engine) which uses SCEP/NDES and therefore need certificates from CA. The thing is the ISE recommend 2008 AD CS as a minimum
    Therefore I wonder if Installing a 2012 R2 Root CA that only provides certificates via the NDES/ISE solution would be a possibility. 
    I understand the Root CA Cert is held in a container under the 'Configuration' partition in Active Directory. Therefore can you have Two Root CA certs in the AD container at the same time for the same AD Domain/Forest?
    The idea would then be to migrate other services to the new CA and phase out the old 2003 R2 CA over time.
    Thanks All
    AAnotherUser__
    AAnotherUser__

    On Thu, 18 Sep 2014 09:18:43 +0000, AAnotherUser wrote:
    Therefore can you have Two Root CA certs in the AD container at the same time for the same AD Domain/Forest?
    Yes.
    Paul Adare - FIM CM MVP
    You are trapped in a maze of screens and ssh sessions all alike.
    It is dark, and you are likely to log off the wrong account. -- Nep

  • Can you have more than one iPod shuffle in one copy of iTune

    Hi,
    I've bought an iPod shuffle each for my two daughters, since they live with their mum I won't be able to set them up for them, anyway, they will be using them on a W2K PC, I am wondering, can you have two iPods set up on the one copy as it were, of iTunes?
    Someone at the Apple store said they'll have to set up two windows users (they all share one login) and login separately, in order for their two libraries to remain separate, with their two ipods? Or is it as simple as creating two libraries, and naming the two iPods separately?

    Hi Angela.
    Welcome to discussions. If you want to ask a question which is totally different from the one which started the topic, then it is best to start a new topic. That way you stand more chance of getting an answer more quickly.
    Plug your shuffle in. Open iTunes (it will probably open automatically). The shuffle will appear in the source list of iTunes. Click the name of your shuffle (in the list). There is a grey bar (at the bottom of iTunes). Make sure that "replace all songs when Autofilling" and "choose songs randomly" are not selected. Then just put the songs on the shuffle that you want and delete any that are already on there that you don't( drag and drop / delete). Then the next time you plug it in, it won't make any changes automatically.
    Basically as long as you never push autofill, then your shuffle should not start doing things of its own accord. So just get the songs you want on there via the drag and drop method (the only method for manual selection). Then never push autofill again.

  • How many playlists can you have or create

    how many playlists can you have or create

    There is no documented limit. 
    Note that Smart Playlists with Live Updating use extra processing, so if you have more than a few dozen of them you may notice a slowdown.
    Some people think they should create a playlist for each album.  If by any chance that is the reason you are asking the question, you will find it is much easier to get to an album via the column browser.

  • How many motions tweens can you have on a timeline?

    I'm a college student in Seattle.  We just had our mid-terms in Flash CS5.  One of the really simple questions was "How many motion tweens can you have on a timeline."  Yup.  The answer is one...... or is it?  I had a long discussion with my tutor (who is the greatest tutor in the world) and he wanted to think about it. I said to him that I thought that one motion tween was wrong because you can click on an object in the timeline, make it a motion tween, and double click it and make several motion tweens.  So, essentially, you can have more than one motion tween on a timeline.  Is anyone able to advise me because this is all about grades!

    You can have quite a few motion tweens on a timeline.  You can even have them happening simultaneously (I don't know of a specific limit), as long as they are all on their own layers.  Though the more you add simultaneously the more they can weigh down the speed of things running.
    If you need to prove this to someone, the easiest way is to create it and demonstrate it.  But you may want to check the exact wording of the question... it would not be beyond an examiner to throw a trick question in.

  • How many Management agents can you have running simultaneously on a host?

    Hi all,
    I've scoured the Oracle documentation and not been able to find a definitive answer to this question, how many Oracle management agents can you have on a single managed host target? Can you for example run an 11g agent and a 12c agent simultaneously (whilst migrating to 12c without upgrading the present OEM instance) If so can you run two 12c agents, each pointing to a different OMS? I’ve seen examples of an agent for each database instance on a host managed target, so a host with three Oracle database instances has three Oracle Management agents all pointing to the same OMS with each agent is monitoring just one of the database instances. There must be resource considerations here for memory, cpu and network traffic etc? I’ve always understood it to be one Oracle Management Agent per managed host
    Thanks

    I don't think there's any data on impact or performance since it's not a recommended configuration. If you have host/configuration monitoring enabled on both agents, they will be running the same queries/scripts against the host/inventory, etc. so they will likely have contention at some point. If you monitor the same databases, you will definitely see contention and increased overhead as there will be multiple agents running the same queries. You might also see problems w/ any of the server generated alerts (tablespace, etc) if you change thresholds as the agents send that to the database, and then the database will be out of sync with the other agents.
    What exactly is the goal for having multiple agents? Is it short term or long term?

  • How many ADFS farms can you have in a single forest/single domain?

    Hi
    I may have some terminology incorrect...please let me know if I do. :)
    My question is, how many ADFS farms can you have in a single forest/single domain? If you want to know why I am asking...please read on.
    We have 1 ADFS Farm and we are looking adding services to it. However not every cloud vendor provides a "Identity Broker" with there services.
    We have a consultant that is advising that we need to enable a SAML-based IdP-initiated single sign-on (SSO) ie using "IdpInitiatedSignOnPage"
    However to do this we need to modify the ADFS website to have "drop down" list so the user can select the "Relying Party" and then authentication with them.
    This means we are exposing a list of every company/party we have federated with. The exposure of this information, is deemed a security concern by our company....which I agree with.
    So the consultant advises that we need a separate ADFS farm. I have searched online, but haven't found any information that confirms multiple ADFS farms can be implemented in a single forest/single domain.
    Thanks for reading and if you have any other suggestions...I'd appreciate it.
    Nyobi

    This is not exactly FIM related question - there is ADFS forum available on Technet. However - technically there is no limit of ADFS farms in a forest \ domain. It is just a service which uses AD and is not altering it in any way or storing some forest-wide
    information like Exchange. So you can setup two ADFS services in single forest - no problem. 
    If it is a best solution to your problem? I can't say with that limited information but maybe just customization of pages on ADFS side would be enough? 
    Tomek Onyszko, memberOf Predica FIM Team (http://www.predica.pl), IdAM knowledge provider @ http://blog.predica.pl

  • HT1420 Can you have more than one device with a different Apple ID authourized to the same computer

    Can you have more than one device with a different Apple ID authourized to the same computer

    I think you are using the same Composition Class on both project. On the properties tab, you can change this number (e.g.: EDGE-1637270).

  • 2013 27" iMac, can you have THREE 27" screens NOT mirrored?

    Straightforward question:
    Say you have the BRAND NEW 2013 27" iMac
    Say you have TWO of the 2013 brand new, thunderbolt 27" external monitors.
    YES you can plug in both the monitors, giving you "three displays"
    HOWEVER
    Can you run this as THREE LOGICAL DISPLAYS.
    So, you can move your mouse pointer completely from monitor A to B to C
    So what I mean is NOT using mirroring in any combination.  Three full logical screens?
    Is this actually possible?
    Has anyone DONE IT and can supply a PHOTO?
    Apple DOES NOT answer this question anywhere.
    Pls do not answer unless you know the difference between mirrored and logical screens, thanks!
    Yes, it says everywhere on the Apple web site you can connect "two external displays".  No big deal.
    Can you actually have three LOGICAL displays (move your mouse pointer completely from monitor A to B to C, the content  of all three screens is completely different).
    This is a straightforward question that I have never seen decisively answered.  Thanks for any info.

    Contacted Apple support with the same question. This is what I heard back. The iMac supports 2 Thunderbolt displays because it has dedicated graphic cards. It supports only 2 thunderbolt displays. Hope it helps.

Maybe you are looking for

  • Error while CIF'fing Sales order to APO

    While I tried to CIF a Sales order from R3 to APO, there is ablicked Q in SMQ1 which reads "Too many parameters specified with perform" in the FM /SAPAPO/CIF_SL_DOC_INBOUND. Any ideas on what mightbe causing this issue and how to resolve this issue ?

  • Stop communication channel after data delivery

    Hi all, I have a communication channel of type JDBC. The channel should be started and stopped via external control. The problem is that I don't know when the data transfer is completed in order to stop the channel. Or is there a functionality that a

  • Submitting Your Podcast to iTunes

    I need to break my question into steps, otherwise it will get confusing. If there is anyone that can advise me on my next steps that would be great! 1. I submitted my Podcast and realized I submitted the incorrect feed URL. 2. I than removed my Podca

  • Will QuickTime Pro Decoders work in Windows Media Player?

    I am working on a Notebook/Laptop with Windows XP Home. This machine does not play DVDs in Windows Media Player. I am considering upgrading to Quicktime Pro for all of its functions. I was just wondering if this would fix Windows Media Player too? Th

  • RAC with OCFS2 shared storage

    Hi all I wont to create RAC env in oracle VM 2.2 (one server) , with lokal disk's which I used to create LVM for ocr in in guest: - two quest with Oracle enterprise linux 5 - both have ocfs2 rpm instaled when I wont to create shared storage for ocr I