Java examples for java.lang:Math Algorithm
Simple method that calculate a tip base on the amount of the bill and a given tip percentage
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { double billAmount = 2.45678; double tipPercentage = 2.45678; System.out.println(calculateTip(billAmount, tipPercentage)); }//from www.j av a 2 s . co m /** * Simple method that calculate a tip base on the amount * of the bill and a given tip percentage * * @param billAmount the amount of the bill * @param tipPercentage the tip to apply to the bill * @return Return the amount of the tip */ public static double calculateTip(double billAmount, double tipPercentage) { return Double.valueOf(billAmount * (tipPercentage)); } }