Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This exercise has 3 classes, DebugVacation, Vacation, and ExtendedVacation . Correct the few coding errors to get the DebugVacation class to work with the other

This exercise has 3 classes, DebugVacation, Vacation, and ExtendedVacation . Correct the few coding errors to get the DebugVacation class to work with the other two classes. Example Output My vacation is for 10 days Your vacation is for 30 days

The debug problem:

// A Vacation is 10 days // but an ExtendedVacation is 30 days public class DebugVacation { public static void main(String args[]) { Vacation myVacation = new Vacation(); ExtendedVacation yourVacation = new ExtendedVacation; System.out.println("My vacation is for " + myVacation.getDays() + " days") System.out.println("Your vacation is for " + yourVacation.getDays() + " days"); } }

//************************************************* //** ExtendedVacation class below this box ** //*************************************************

class ExtendedVacation extends Vacation { public ExxtendedVacation() { days = 30; } }

//************************************************ //** Vacation Class below this box ** //************************************************

class Vacation { protected int days; public vacation() { days = 10; } public int getDays() { return days; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What styles do they use?

Answered: 1 week ago