Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Vehicle/bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/model/
Binary file modified Vehicle/bin/VehicleNoise.class
Binary file not shown.
3 changes: 3 additions & 0 deletions Vehicle/src/VehicleNoise.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import model.Example;
import model.Train;
import model.DirtBike;

public class VehicleNoise {

Expand All @@ -14,6 +15,8 @@ public static void main(String[] args) {
Train train = new Train();
System.out.println(train.makeNoise());

DirtBike dirtbike = new DirtBike("Eli Tomac", 450, "Blue");
System.out.println(dirtbike.makeNoise());
}

}
77 changes: 77 additions & 0 deletions Vehicle/src/model/DirtBike.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/**
* @author Valerie Underwood - vlunderwood
* CIS175 - Fall 2023
* Aug 28, 2023
*/

package model;

public class DirtBike {

// Instance variables describing the dirtbike
private String name;
private String color;
private Integer size;

// Parameterized constructor that accepts color, size, and name
public DirtBike(String name, Integer size, String color) {
this.name = name;
this.size = size;
this.color = color;
}

// Getter method for name
public String getName() {

return name;

}

// Setter method for name
public void setName(String name) {

this.name = name;

}

// Getter method for size
public Integer getSize() {

return size;

}

// Setter method for size
public void setSize(Integer size) {

this.size = size;

}

// Getter method for color
public String getColor() {

return color;

}

// Setter method for color
public void setColor(String color) {

this.color = color;

}

// overrides toString and returns dirtbikes description
@Override
public String toString() {
return "Vehicle [Rider Name=" + name + ", Engine size=" + size + ", color=" + color + "]";
}

// returns the dirtbike noise
public String makeNoise() {

return "Vroom! Vroom!";

}
}