Advertisement
Guest User

Untitled

a guest
Feb 6th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.Random;
  3. import java.text.DecimalFormat;
  4.  
  5. public class SpaceTicket {
  6.  
  7.    static final double STUDENT_DISCOUNT = .25;
  8.    static final double CHILD_DISCOUNT = .35;
  9.  
  10.    public static void main(String[] args) {
  11.    
  12.       Scanner scan = new Scanner(System.in);
  13.       String input = "12579500s15300701209817DSpaceX-001 Earth to Mars";
  14.       double inputCode;
  15.       double price = 125795.00;
  16.       char s;
  17.       s = (price *  0.25);
  18.       char c;
  19.       c = (price * 0.35);
  20.       int random;
  21.       System.out.print("Enter ticket code: ");
  22.       Random generator = new Random();
  23.       DecimalFormat dFmt = new DecimalFormat("#,##0.0####");
  24.       inputCode = scan.nextDouble();
  25.       if (inputCode == 12579500) {
  26.      
  27.          System.out.print("\nSpace Ticket: SpaceX-001 Earth to Mars");
  28.          System.out.print("\nDate: 07/01/2098   Time: 15:30   Seat: 17D");
  29.          System.out.print("\nPrice: $125,795.00   Category:");
  30.          random = generator.nextInt(1000000);
  31.          System.out.print("\nPrize Number: " + random);  
  32.      
  33.       }
  34.      
  35.       else {
  36.          System.out.print("*** Invalid ticket code ***");
  37.          System.out.print("\nTicket code must have at least 25 characters.");
  38.       }
  39.    
  40.    }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement