Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 17th, 2012  |  syntax: None  |  size: 1.06 KB  |  hits: 5  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package model;
  6.  
  7. import java.util.ArrayList;
  8. import java.util.List;
  9.  
  10. /**
  11.  *
  12.  * @author a00720398
  13.  */
  14. public enum Unit {
  15.  
  16.     KM(1.0), Miles(1.609344);
  17.     private double convert = 0;
  18.     private double km  = 5.0, miles = 9.0;
  19.  
  20.     Unit(double convert) {
  21.         this.convert = convert;
  22.     }
  23.  
  24.  
  25.     public List<Unit> getUnits() {
  26.  
  27.         List<Unit> list = new ArrayList<Unit>();
  28.         for (Unit someType : Unit.values()) {
  29.             list.add(someType);
  30.         }
  31.         return list;
  32.     }
  33.  
  34.     /**
  35.      * @return the km
  36.      */
  37.     public double getKm() {
  38.         return km;
  39.     }
  40.  
  41.     /**
  42.      * @param km the km to set
  43.      */
  44.     public void setKm(double km) {
  45.         this.km = km;
  46.     }
  47.  
  48.     /**
  49.      * @return the miles
  50.      */
  51.     public double getMiles() {
  52.         return miles;
  53.     }
  54.  
  55.     /**
  56.      * @param miles the miles to set
  57.      */
  58.     public void setMiles(double miles) {
  59.         this.miles = miles;
  60.     }
  61. }