Train Tickets Machine:
Write a program to sell train tickets.
There are three type of tickets A,B,C to New Jersey, New York.
The prices are as follow:
New Jersey : $15.00 (C), $17.75(B), $20.90 (A)
New York : $17.50 (C), $19.75(B), $22.50 (A)
There are 10 tickets of each type (Total=60 tickets)
The program will ask the user which tickets he want to buy, then ask him to put money,
The program will accept: $100,$50,$20,$10,$5,$1 dollars bills, and 25,10,5 cents coins.
The program should reject any other amount.
The program will keep asking the user for more money till the money amount put is equal to or more than the price of the ticket, If it is more, the program will return the exceeding amount.
Then the program will continue indefinitely asking users which ticket they want to buy.
If there are no more ticket available of certain type, the program should display this at the beginning.
If no ticket are available in the machine at all, the message displays should be : Machine closed: SOLD OUT.
Example of output
Which state you buy ticket to: (1: New jersey, 2: New York): 2
Which ticket class you want to buy (1: A, 2: B, 3:C): B
The price of New York ticket class B is : $19.75
Please put money in the machine:$ 5
You have $5, put more: $17
Rejected, You have $5, put more: $1
You have $6, put more: $.25
You have $6.25, put more: $10
You have $16.25, put more: $5
Thank you.
Please take your ticket.
You change is $1.50, please take them
New York ticket class B are SOLD OUT.
Which state you buy ticket to: (1: New jersey, 2: New York): 2
Which ticket class you want to buy (1: A, 3:C):