Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Christopher Clemente
- //Comp 171-002
- //Homework #1
- package project;
- import java.util.Scanner;
- public class Hw1 {
- public static void main(String[] args) {
- System.out.println("Please enter a subtotal and gratuity rate!");
- Scanner keyboard = new Scanner(System.in);
- System.out.print("Subtotal :: ");
- double sub = keyboard.nextDouble();
- System.out.print("Gratuity Rate :: ");
- double grat = keyboard.nextInt();
- double gratuity = (sub * (grat / 100));
- double total = sub + gratuity;
- System.out.println("The gratuity is $" + gratuity + " and the total is $" + total);
- }
- }
- /*
- Please enter a subtotal and gratuity rate!
- Subtotal :: 10
- Gratuity Rate :: 15
- The gratuity is $1.5 and the total is $11.5
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement