• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

enums

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
this is question from Assignments from K& B book.

public class Bridge{
public enum Suites{
CLUBS(20),DIAMONDS(20),HEARTS(30),SPADES(30),NOTRUMP(40){public int getValue(int bid)
return ((bid-1)*30)+40;}};
Suites(int points){this.points=points;}
private int points;
public int getValue(int bid){return points*bid;}
}
public static void main(String[] args){
System.out.println(Suits.NOTRUMP.getBidValue(3));
System.out.println(Suits.SPADES+" "+Suits.SPADES.points);
System.out.println(Suits.values());
}
}

ans:a)output could contain 30
b)output could contain @bf73fa

please help me with this.
thanks
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What exactly is your question ? If you have a specific question about the code snippet do post it here. Please also use CODE tags when displaying code.
 
Why does your bag say "bombs"? The reason I ask is that my bag says "tiny ads" and it has stuff like this:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic