Advertisement
RazorBlade57

Untitled

Sep 20th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. //Christopher Clemente
  2. //Comp 171-002
  3. //Homework #1
  4.  
  5. package project;
  6. import java.util.Scanner;
  7.  
  8. public class Hw1 {
  9.  
  10.  
  11. public static void main(String[] args) {
  12. System.out.println("Please enter a subtotal and gratuity rate!");
  13.  
  14. Scanner keyboard = new Scanner(System.in);
  15.  
  16. System.out.print("Subtotal :: ");
  17. double sub = keyboard.nextDouble();
  18.  
  19. System.out.print("Gratuity Rate :: ");
  20. double grat = keyboard.nextInt();
  21.  
  22. double gratuity = (sub * (grat / 100));
  23. double total = sub + gratuity;
  24.  
  25. System.out.println("The gratuity is $" + gratuity + " and the total is $" + total);
  26.  
  27. }
  28.  
  29. }
  30.  
  31. /*
  32. Please enter a subtotal and gratuity rate!
  33. Subtotal :: 10
  34. Gratuity Rate :: 15
  35. The gratuity is $1.5 and the total is $11.5
  36. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement