Question

Debugging Exercise 10-2 

Debugging Exercise 10-2 0 Instructions DebugExtende... DebugTen2.java DebugVacatio... + >- Terminal LU 1 public class Debug EDebugging Exercise 10-2 0 x 1 structions DebugExtende... DebugTen2.java DebugVacatio... + > Terminal + 1 // A Vacation is 10Debugging Exercise 10-2 0 Instructions DebugExtende... Debugten2.java DebugVacatio... + >- Terminal 1 public class DebugVacat


1 0
Add a comment Improve this question Transcribed image text
Answer #1

DebugVacation.java

public class DebugVacation {
   protected int days;
   public DebugVacation()
   {
       days=10;
   }
   public int getDays()// mathod name is getDays()
   {
       return days;
   }

}

DebugExtendedVacation.java

public class DebugExtendedVacation extends DebugVacation //if you want to use inheritance
// we need to use the key word extends
{ //ischildOff replae by extends
   public DebugExtendedVacation()
   {
       days=30;
   }

}

DebugTen2.java

public class DebugTen2 {
   public static void main(String args[])
   {
       DebugVacation myVacation=new DebugVacation();
       DebugExtendedVacation yourVacation=new DebugExtendedVacation();
      
       System.out.println("My vacation is for "+myVacation.getDays()+" days");
       System.out.println("Your vacation is for "+yourVacation.getDays()+" days");
      
   }

}

D DebugExtendedVacation.java D DebugTen2.java X D DebugVacation.java 1 package debug; 3 public class DebugTen2 { public stat

Add a comment
Know the answer?
Add Answer to:
Debugging Exercise 10-2
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Debugging Exercise 1-2

    Debugging Exercise 1-2 

  • Debugging Section Exercise #1 50 points Plus up to 10 points extra The following pseudocode contains...

    Debugging Section Exercise #1 50 points Plus up to 10 points extra The following pseudocode contains errors. You must find 3 or more errors in each of the following programs. If you find more than 3 mistakes, you will earn extra credit points. This pseudocode should determine the rental fees for cars Standard cars rent for $65 per day. compacts rent for $40 per day and subcompacts rent for $30 per day Rentals for at least 7 days receive a...

  • Debugging exercise Programmer Began programming the following program, but made some mistakes. Please debug: class Student{...

    Debugging exercise Programmer Began programming the following program, but made some mistakes. Please debug: class Student{     private int id;     private String name;     private String city;       Student(String name, String city){         this.name = name;         this.city = city;     }        Student(int id, String place){         this.id = id;         this.place =name;     }        void Student(int id, String name, String city){         this.id = id;         this.name = name;         this.city =...

  • a) Why must a program specifically be compiled for debugging to be able to execute that...

    a) Why must a program specifically be compiled for debugging to be able to execute that program in a debugger? What two things does the compiler do to assist a debugger?

  • C++ Explain the fundamental principles of testing and debugging Please do not copy from a website!

    C++ Explain the fundamental principles of testing and debugging Please do not copy from a website!

  • // 2. Practice debugging this program. It has approximately 22 compiler errors, 1 logic error and...

    // 2. Practice debugging this program. It has approximately 22 compiler errors, 1 logic error and //1 usability error. Identify them all. import java.util.scanner; //This program finds the average of three input values. public class Arithmeticx { public static void main( String [] args ) // declare variables double number1, number2, number3; // input data scanner in = newscanner( ); System.out.print( "Number 1? " ); System.out.print( "Number 2? " ); System.out.print( "Number 3? " ); number 1 = in.nextDouble; number...

  • - Part 1 – 4 Debugging Exercises – there are things wrong – either logic or...

    - Part 1 – 4 Debugging Exercises – there are things wrong – either logic or syntax errors.  Correct the pseudocode and one Java program. Add the corrected code in BOLD and change the corrected color to RED.   Debugging 4:  Add the missing code in bold and red. import java.util.Scanner; public class Airline {             public static void main(String args[])             {                         Scanner s = new Scanner(System.in);                         String passengerName = ""                              String ageString = ""                           int passengerAge = 0                         System.out.println("Enter passenger's name: ");                         passengerName  =...

  • Java debugging in eclipse package edu.ilstu; import java.util.Scanner; /** * The following class has four independent...

    Java debugging in eclipse package edu.ilstu; import java.util.Scanner; /** * The following class has four independent debugging * problems. Solve one at a time, uncommenting the next * one only after the previous problem is working correctly. */ public class FindTheErrors { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); /* * Problem 1 Debugging * * This problem is to read in your first name, * last name, and current year and display them in *...

  • LAB 2 SUBJECT: Algorithms, Compiling, Debugging Goal: Enter and compile a program. Write an algorithm (psuedo...

    LAB 2 SUBJECT: Algorithms, Compiling, Debugging Goal: Enter and compile a program. Write an algorithm (psuedo code) to calculate the shaded area of the object below Algorithm should be general: It should work for all values of A,B,C,D and different number of boxes (drawing below shows 3 x 3 shaded boxes and 1 x 1 white boxes). Do not assume A=B or C-D (as shown in the first diagram). Do not assume that the boxes are 3x3 and 1x 1....

  • Section 6.9 of your textbook ("Debugging") lists three possibilities to consider if a function is not...

    Section 6.9 of your textbook ("Debugging") lists three possibilities to consider if a function is not working. Describe each possibility in your own words. Define "precondition" and "postcondition" as part of your description. Create your own example of each possibility in Python code. List the code for each example, along with sample output from trying to run it.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT