Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.Random;
- import java.text.DecimalFormat;
- public class SpaceTicket {
- static final double STUDENT_DISCOUNT = .25;
- static final double CHILD_DISCOUNT = .35;
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String input = "12579500s15300701209817DSpaceX-001 Earth to Mars";
- double inputCode;
- double price = 125795.00;
- char s;
- s = (price * 0.25);
- char c;
- c = (price * 0.35);
- int random;
- System.out.print("Enter ticket code: ");
- Random generator = new Random();
- DecimalFormat dFmt = new DecimalFormat("#,##0.0####");
- inputCode = scan.nextDouble();
- if (inputCode == 12579500) {
- System.out.print("\nSpace Ticket: SpaceX-001 Earth to Mars");
- System.out.print("\nDate: 07/01/2098 Time: 15:30 Seat: 17D");
- System.out.print("\nPrice: $125,795.00 Category:");
- random = generator.nextInt(1000000);
- System.out.print("\nPrize Number: " + random);
- }
- else {
- System.out.print("*** Invalid ticket code ***");
- System.out.print("\nTicket code must have at least 25 characters.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement