Answer to Question #279577 in Java | JSP | JSF for Jade

Question #279577

Enter the subtotal and gratuity rate: 10 12 The gratuity is $1.2 and total is $11.2

1
Expert's answer
2021-12-14T13:33:59-0500


package gratuity;


import java.util.Scanner;




public class Gratuity {


  
    public static void main(String[] args) {
     
        
        Scanner scan = new Scanner(System.in);
        System.out.println("Enter the subtotal and gratuity rate:   ");
        float subtotal = scan.nextFloat();
        double rate = scan.nextDouble();
        rate = 0.01 * rate;
        System.out.printf("The gratuity is $%f and total is $ %f", (rate * subtotal), ((rate * subtotal)+ subtotal));
    }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog