Java Fraction Create fraction(int denominator)

Here you can find the source of fraction(int denominator)

Description

fraction

License

Open Source License

Declaration

public static String fraction(int denominator) 

Method Source Code

//package com.java2s;
/*   This file is part of SpeechCookingAssistant.
 *
 *   SpeechCookingAssistant is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, version 3
 *
 *   SpeechCookingAssistant is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with SpeechCookingAssistant.  If not, see <http://www.gnu.org/licenses/>.  
 * /*from ww w  .  j  a v a2  s.co  m*/
 *   Copyright 2011 Michael Shafir
 *   Michael.Shafir@gmail.com
 */

public class Main {
    public static String fraction(int denominator) {
        switch (denominator) {
        case 2:
            return "half";
        case 3:
            return "third";
        case 4:
            return "quarter";
        case 8:
            return "eighth";
        default:
            return "";
        }
    }
}

Related

  1. frac(double x)
  2. frac(float x)
  3. frac(int f)
  4. fraction(double decimal, double tolerance)
  5. fraction(double number)