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");
}
}
Debugging Exercise 1-2
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...
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!
// 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 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 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 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 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.
A. toggle B. debugging C. output cell D. range name Which of the following should be entered first when building a spreadsheet model? A. The objective cell B. The changing cells C. The output cell D. The data cells