first commit
This commit is contained in:
33
Semester 1/Programming 1/Java/examples/debugdemo/Car.java
Normal file
33
Semester 1/Programming 1/Java/examples/debugdemo/Car.java
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Class Car - nonsense class for debugger demo
|
||||
*
|
||||
* @author Michael Kolling
|
||||
* @version 13 August 1999
|
||||
*/
|
||||
public class Car
|
||||
{
|
||||
private int numberOfFrontSeats;
|
||||
private int numberOfBackSeats;
|
||||
|
||||
/**
|
||||
* Create a car with seat numbers
|
||||
*/
|
||||
public Car(int frontSeats, int backSeats)
|
||||
{
|
||||
numberOfFrontSeats = frontSeats;
|
||||
numberOfBackSeats = backSeats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of seats in the car.
|
||||
*/
|
||||
public int seats()
|
||||
{
|
||||
int totalSeats;
|
||||
|
||||
totalSeats = numberOfFrontSeats;
|
||||
totalSeats += numberOfBackSeats;
|
||||
|
||||
return totalSeats;
|
||||
}
|
||||
}
|
61
Semester 1/Programming 1/Java/examples/debugdemo/Demo.java
Normal file
61
Semester 1/Programming 1/Java/examples/debugdemo/Demo.java
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Class Demo - this class is used in the BlueJ tutorial for demonstrating
|
||||
* the BlueJ debug functionality. It contains loops and nested method calls
|
||||
* that make interesting examples to set breakpoints.
|
||||
*
|
||||
* @author M. Kolling
|
||||
* @version 13 August 1999
|
||||
*/
|
||||
public class Demo
|
||||
{
|
||||
private String name;
|
||||
private int answer;
|
||||
|
||||
/**
|
||||
* Constructor for objects of class Demo
|
||||
*/
|
||||
public Demo()
|
||||
{
|
||||
name = "Marvin";
|
||||
answer = 42;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loop for a while and do some meaningless computations.
|
||||
*/
|
||||
public int loop(int count)
|
||||
{
|
||||
int sum = 17;
|
||||
|
||||
for (int i=0; i<count; i++) {
|
||||
sum = sum + i;
|
||||
sum = sum - 2;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for demonstrating single stepping with nested method call.
|
||||
*/
|
||||
public int carTest()
|
||||
{
|
||||
int places;
|
||||
Car myCar = new Car(2, 3);
|
||||
|
||||
places = myCar.seats();
|
||||
return places;
|
||||
}
|
||||
|
||||
public int longloop()
|
||||
{
|
||||
int sum = 0;
|
||||
|
||||
for (int i=0; i<20000000; i++) {
|
||||
sum = sum + i;
|
||||
sum = sum -200;
|
||||
}
|
||||
return 42;
|
||||
}
|
||||
|
||||
|
||||
}
|
12
Semester 1/Programming 1/Java/examples/debugdemo/README.TXT
Normal file
12
Semester 1/Programming 1/Java/examples/debugdemo/README.TXT
Normal file
@@ -0,0 +1,12 @@
|
||||
BlueJ example project "debugdemo"
|
||||
|
||||
Copyright (c) Michael Kolling, Monash University, 1999-2000
|
||||
|
||||
This project is distributed with the BlueJ system to provide an example
|
||||
for testing the debugger. The project does not make any sense at all. Its
|
||||
purpose is to provide some loops and method calls to practice setting
|
||||
breakpoints and sigle-stepping through the code.
|
||||
|
||||
This project is referred to in the BlueJ tutorial.
|
||||
|
||||
To start this project, create a "Demo" object and select any of its methods.
|
24
Semester 1/Programming 1/Java/examples/debugdemo/bluej.pkg
Normal file
24
Semester 1/Programming 1/Java/examples/debugdemo/bluej.pkg
Normal file
@@ -0,0 +1,24 @@
|
||||
#BlueJ package file
|
||||
dependency1.from=Demo
|
||||
dependency1.to=Car
|
||||
dependency1.type=UsesDependency
|
||||
package.editor.height=250
|
||||
package.editor.width=468
|
||||
package.editor.x=40
|
||||
package.editor.y=62
|
||||
package.numDependencies=1
|
||||
package.numTargets=2
|
||||
target1.height=50
|
||||
target1.modifiers=0
|
||||
target1.name=Demo
|
||||
target1.type=ClassTarget
|
||||
target1.width=80
|
||||
target1.x=70
|
||||
target1.y=40
|
||||
target2.height=50
|
||||
target2.modifiers=0
|
||||
target2.name=Car
|
||||
target2.type=ClassTarget
|
||||
target2.width=80
|
||||
target2.x=220
|
||||
target2.y=100
|
Reference in New Issue
Block a user