I had an excellent response to an earlier question so I'm going to push my luck here. While there is an excellent post already about this;What does a "Cannot find symbol" compilation error mean? I am stuggleing to find which reason applies and why.
The error here occurs when creating the object FirstClassTicket, both before and after the equals where it calls FirstClass. I assume I have made an error when I inherited FirstClass from Ticket as this was originally running fine calling Ticket before I began to include to different Ticket types.
class Booking{
public static class Ticket{
int Price;
int Amount=1;
int Discount=0;
public int WhatCost(){
int Cost =Amount*(Price-Discount);
return Cost;
}
//Inheriting Ticket classes.
class FirstClass extends Ticket{ //Defines standard class tickets.
int Price =10;
}
}
public static void main(String args[]) {
FirstClass FirstClassTicket=new FirstClass();
Scanner scanner = new Scanner(System.in);
System.out.println("Welcome to the advance booking service.");//Introduce program.
System.out.println("A first class ticket costs:");
System.out.println(FirstClassTicket.WhatCost());
}
}