Bill Amount Java Program
Java Code:
import java.util.Scanner;
public class calculate {
/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated
method stub
Scanner input = new Scanner(System.in);
System.out.print("Enter the Food amount: ");
float FA =
input.nextFloat();
System.out.print("Enter the gratuity rate in percent:
");
float GR = input.nextFloat();
float a=(GR*FA)/100;
float b=FA+a;
System.out.printf("Food amount:
" +
"%.2f", FA);
System.out.println();
System.out.printf("GRATUITY:
"+"%.2f", a);
System.out.println();
System.out.printf("Total Bill:
" +"%.2f", b);
}
}
No comments:
Post a Comment