Advertisement
nailacrooc12

Card

Jan 24th, 2024
3,775
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.73 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Test
  4. {
  5.     public static void main(String[] args) {
  6.         int amount;
  7.         Card card1 = new Card(500, 1000, 1);
  8.         Card card2 = new Card(200, 700, 2);
  9.         Game game = new Game();
  10.         Terminal term = new Terminal();
  11.        
  12.         System.out.println("What do you want to do? Pick a number");
  13.         System.out.println("1. Buy Credits\n2. Play a game\n3. Go to Terminal\n*********************************" );
  14.         Scanner in = new Scanner (System.in);
  15.         int act = in.nextInt();
  16.        
  17.         if (act == 1){
  18.             System.out.println("Pick which card you want to load credits with: \n1. Card 1\n2. Card 2\n*********************************");
  19.             int cardPick = in.nextInt();
  20.             if (cardPick == 1){
  21.                 System.out.println("Enter amount of credits: \n*********************************");
  22.                 amount = in.nextInt();
  23.                 card1.buyCredits(amount);
  24.                 System.out.println("Credit balance is : " + card1.getCB() + "\n*********************************");
  25.                 main(null);
  26.             }else if (cardPick == 2){
  27.                 System.out.println("Enter amount of credits: ");
  28.                 amount = in.nextInt();
  29.                 card2.buyCredits(amount);
  30.                 System.out.println("Credit balance is : " + card2.getCB() + "\n*********************************");
  31.                 main(null);
  32.             }else{
  33.                 System.out.println("SYSTEM ERROR");
  34.             }
  35.         }else if (act == 2){
  36.             game.Begin();
  37.         }else if (act == 3){
  38.             term.Terminal();
  39.         }else{
  40.             System.out.println("SYSTEM ERROR");
  41.         }
  42.        
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement