Question: Bellow is what I've written so far... I ' m having a hard time getting it to print out usingThe answer is: + myAnswer.
Bellow is what I've written so far... Im having a hard time getting it to print out using"The answer is: myAnswer. When compiling it has to print out "The answer is: Childs Ticket" but I dont know how to set the value of myAnswer to three different statments senior ticket, adult ticket, and childs ticket.
import java.util.Scanner; class scanner
public class BusTicket
public static void mainString args
int myAnswer;
Scanner input new ScannerSystemin;
System.out.printEnter age: ; promt
int userAge input.nextInt; read input from user
if userAge
System.out.printfSenior Ticket";
else if userAge
System.out.printfAdult Ticket";
else if userAge
System.out.printfChildss Ticket";
end of main method
end Comment Header
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
