Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Need Help with a basic java program

damo1982damo1982 Member Posts: 2
Hi I recently got a new assignment from college and am unable to complete and was hoping someone here could help me we have to basically set up a ticket machine where you input name of show name of person how many in the booking if theres is over 6 in the booking you get a 10% discount and at the end you have to input y or n for the program to restart i have worked out most of the program except for the last couple of lines for the do while loop if someone could please show me where I am going wrong it would be much appreciated

class project //class(name of program)
public static void main(String[] args) //main method to be included in all programs
int numberpeople, cost, ticketcost, discount, discountcost;
String surname, nameofshow;
char awnser;
ticketcost = 25;

System.out.println("Hello What is the surname the booking was made under");
surname = EasyIn.getString();

System.out.println("What is the name of the show you wish to see");
nameofshow = EasyIn.getString();

System.out.println("How many people are in your party");
numberpeople = EasyIn.getInt();

System.out.println("*******************************Tickets Printout********************************");
System.out.println(" Show : " + nameofshow);
System.out.println(" Surname : " + surname);
System.out.println(" No.In Party : " + numberpeople);

discount =(cost/100*10);
discountcost =(cost-discount);

cost =(ticketcost*numberpeople);
System.out.println(" Cost : " + discountcost);

if(numberpeople<=5);<br />
cost =(ticketcost*numberpeople);
System.out.println(" Cost : " + cost);


System.out.println("Would you like to print another ticket Please awnser only with lowercase (y/n)?");
if (awnser=='y') System.out.println("Please wait for the program to restart");
if (awnser=='n')System.out.println("Have a nice day");
else if System.out.println("Invalid Selection");
while ((awnser !='y')&&(awnser='n'));

} //end of program

Sign In or Register to comment.