Here you can find the source of fraction(int denominator)
public static String fraction(int denominator)
//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 ""; } } }