Thursday, 4 July 2013

Bill Amount Java Program

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);

        }
       }



 Program Snapshots:

 

No comments:

Post a Comment