daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Feb 21st, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  public class PetstoreCalculator
  3.  {
  4.    public static void main(String[] args){
  5.      int option;
  6.      boolean check = false;
  7.      Scanner input = new Scanner(System.in);
  8.      option = 0;
  9.    
  10.      double total,storetax;
  11.    
  12.      storetax = 1.05;
  13.      do{
  14.            
  15.             System.out.println("What pet would you like to purchase: ");   
  16.             System.out.println("1. Snakes");
  17.             System.out.println("2. Turtles");
  18.             System.out.println("3. Geckos");
  19.             System.out.println("4. Iguanas ");
  20.            
  21.        System.out.println("Enter Choice: ");
  22.        
  23.        option = input.nextInt();
  24.        total = 0;    
  25.        
  26.        if (option == 1){
  27.         System.out.println("25");
  28.        
  29.         total = 25 * storetax;
  30.        
  31.         System.out.println("The total cost is: $"  +total);
  32.         System.exit(0);
  33.        }
  34.        else if (option == 2){
  35.          System.out.println("$20");
  36.          
  37.          total = 20 * storetax;
  38.          
  39.          System.out.println("The total cost is: $" +total );
  40.          System.exit(0);
  41.        }
  42.        else if (option == 3){
  43.          System.out.println("$35");
  44.          
  45.          total = 35 * storetax;
  46.          
  47.          System.out.println("The total cost is: $" +total );
  48.          System.exit(0);
  49.        }
  50.        
  51.        else if (option == 4){
  52.          System.out.println("$45");
  53.          
  54.          total = 45 * storetax;
  55.        
  56.          System.out.println("The total cost is: $" +total );
  57.          System.exit(0);
  58.        }
  59.        else if (option == 0){
  60.          System.out.println("Thank you!");
  61.          System.exit(0);
  62.          
  63.        }
  64.        else{
  65.          System.out.println("Error, entered wrong number.");
  66.        }
  67.        
  68.        goodbye();
  69.        
  70.       while (!check);
  71.      
  72.   }while (option >= 5);
  73.      
  74.    } //end main
  75.  
  76. private static void goodbye() {
  77.    
  78.     String goodbye = "\n ***Good Bye, Have a Nice Day***";
  79.    
  80.     System.out.println( goodbye );
  81.    
  82. }
  83.  
  84.  
  85. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top