/******************************************************************/
/* Java Program for weekend festival */
/* Written by: Sean O'Mahony */
/* Course: Computing */
/* Language: Java */
/* Data started:14/10/2008 */
/* Last update:14/10/2008 */
/* Program description: */
/******************************************************************/
class project
{
public static void main(String[] args)
{
int number_ticket, ticket_type;
double cost=0;
char go_again;
String name;
do
{
System.out.println("***************************************************************");
System.out.println("* *");
System.out.println("* 1). Day Ticket 96.50 Euro Per Person *");
System.out.println("* 2). Weekend ticket with camping 224.50 Euro Per person *");
System.out.println("* 3). Weekend ticket no camping 177.50 Euro per person *");
System.out.println("* *");
System.out.println("***************************************************************");
System.out.println("Please enter the type of ticket you would like");
ticket_type=Keyboard.readInt();
while(ticket_type<1||ticket_type>3)
{
System.out.println("Invalid number, please enter a number between 1 and 3");
System.out.println("Plese try again");
ticket_type=Keyboard.readInt();
}
switch(ticket_type)
{
case 1:cost=96.50; break;
case 2:cost=224.50; break;
case 3:cost=177.50;
} //end of switch
System.out.println("Please enter your surname");
name=Keyboard.readString();
System.out.println("Please enter the number of tickets you which to purchase");
System.out.println("The max amount is 4");
number_ticket=Keyboard.readInt();
while(number_ticket<1||number_ticket>4)
{
System.out.println("Invalid number, maximum number of tickets is 4");
System.out.println("Please try again");
} //end of while loop
cost=cost*number_ticket;
System.out.println("Festivle Ticket Type= " + ticket_type);
System.out.println("Surname= " + name);
System.out.println("No in Party= " + number_ticket);
System.out.println("Total cost= " + cost);
System.out.println("Would you like to go again?");
go_again=Keyboard.readChar();
go_again=Character.toUpperCase(go_again);
while(go_again!='Y'||go_again!='N')
{
System.out.println("Invalid, please enter either Y or N");
System.out.println("Would you like to go again?");
go_again=Keyboard.readChar();
} // end of while
}while(go_again=='Y'); //end of while
System.out.println("Thank you and goodbye");
} //end of main
} //end of class