Question: I'm getting the error Identifier Expected when trying to compile my subclasses and can't spot the error. Hoping someone can help me out. Thank you

I'm getting the error "Identifier Expected" when trying to compile my subclasses and can't spot the error. Hoping someone can help me out. Thank you for the help!

// abstract class

public abstract class Vacation { public abstract double Budget(); }

// subclass of the abstract class

public class AllInclusiveVacation extends Vacation { // initialize budget public double myBudget; public double budgetCompare; // Constructor for the class public AllInclusiveVacation(double myBudget) { this.myBudget = myBudget; } // method that prints out the brand public void Brand() { System.out.println("ClubMed"); } // method that prints out the rating public void Rating() { System.out.println("4 stars"); } // method that prints out price public double Price() { return 4500.62; } // method that compares the budget with the price public double Budget(myBudget) { budgetCompare = myBudget - 4500.62; return budgetCompare; } }

// test class

public class TestMyVacation { public static void main (String [] args) { // creating test objects AllInclusiveVacation Alpha = new AllInclusiveVacation(4500); PiecemealVacation Beta = new PiecemealVacation(3000); // not used yet System.out.print("Brand = " ); Alpha.Brand(); System.out.print("Rating = "); Alpha.Rating(); System.out.print("Price = $"); Alpha.Price(); System.out.print("Budget is (negative inicates under budget): "); Alpha.Budget();

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!