import java.util.Scanner;
/**
 * Calculates the suggested tip
 */
public class TipCalculator
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        
        //get the cost
        System.out.print("What was the cost of your cruise? ");
        double cost = scan.nextDouble();
        if (cost <= 0)
        {
            System.out.println("The cost must be a positive number");
            return;
        }
        
        //get the satisfaction
        System.out.print("What is your statisfaction rating? 0 is poor and 3 is great: ");
        int satisfaction = scan.nextInt();
        
        double tip = 0;
        if (satisfaction == 0)
        {
            tip = cost * 5.0/100;
            System.out.printf("\nThe tip should be $%.2f", tip);
        }
        else if (satisfaction == 1)
        {
            tip = cost * 10.0/100;
            System.out.printf("\nThe tip should be $%.2f", tip);
        }
        else if (satisfaction == 2)
        {
            tip = cost * 15.0/100;
            System.out.printf("\nThe tip should be $%.2f", tip);
        }
        else if (satisfaction == 3)
        {
            tip = cost * 20.0/100;
            System.out.printf("\nThe tip should be $%.2f", tip);
        }
        
        else 
        {
            System.out.println("\nThe satisfaction rating must be 0, 1, 2, or 3");
        }
        
    }
}
