From e4a81ecfd0b8e88156a441c1028a45a93ae4da3a Mon Sep 17 00:00:00 2001 From: Corbin Goodman <32312484+Pyr0morpher@users.noreply.github.com> Date: Tue, 29 Aug 2023 18:13:30 -0500 Subject: [PATCH 1/4] Update VehicleNoise.java added Motorcycle object --- Vehicle/src/VehicleNoise.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Vehicle/src/VehicleNoise.java b/Vehicle/src/VehicleNoise.java index d66a1ed..0928582 100644 --- a/Vehicle/src/VehicleNoise.java +++ b/Vehicle/src/VehicleNoise.java @@ -2,6 +2,7 @@ import model.Example; import model.Car; import model.Train; +import model.Motorcycle public class VehicleNoise { @@ -23,6 +24,10 @@ public static void main(String[] args) { // my vehicle noise Car Mustang = new Car(); System.out.println(Mustang.makeNoise()); + + // Motorcycle + Motorcycle motorcycle = new Motorcycle(); + System.out.println(motorcycle.makeNoise()); } From 279d7810f436333577ec0c98d311addee31b91c0 Mon Sep 17 00:00:00 2001 From: Corbin Goodman <32312484+Pyr0morpher@users.noreply.github.com> Date: Tue, 29 Aug 2023 18:14:46 -0500 Subject: [PATCH 2/4] Uploaded Motorcycle.java --- Vehicle/src/model/Motorcycle.java | 57 +++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Vehicle/src/model/Motorcycle.java diff --git a/Vehicle/src/model/Motorcycle.java b/Vehicle/src/model/Motorcycle.java new file mode 100644 index 0000000..1102c48 --- /dev/null +++ b/Vehicle/src/model/Motorcycle.java @@ -0,0 +1,57 @@ +package model; + +/** + * @author Corbin Goodman - cgoodman4 + * CIS175 - Fall 2023 + * Aug 29, 2023 + */ + +public class Motorcycle{ + private int year; + private String make; + private String model; + + public Motorcycle() { + super(); + } + + public Motorcycle(int year, String make, String model) { + this.year = year; + this.make = make; + this.model = model; + } + + public int getYear() { + return year; + } + + public void setYear(int year) { + this.year = year; + } + + public String getMake() { + return make; + } + + public void setMake(String make) { + this.make = make; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Override + public String toString() { + return String.format("This motorcycle is a %d %s %s",this.year,this.make,this.model); + } + + public String makeNoise() { + return "vroom vroom"; + } +} + From e88d5c99d3ed68ebb8e463fd7c748f32b287f0be Mon Sep 17 00:00:00 2001 From: Corbin Goodman <32312484+Pyr0morpher@users.noreply.github.com> Date: Tue, 29 Aug 2023 18:20:00 -0500 Subject: [PATCH 3/4] Update Motorcycle.java added documentation --- Vehicle/src/model/Motorcycle.java | 150 ++++++++++++++++++++---------- 1 file changed, 102 insertions(+), 48 deletions(-) diff --git a/Vehicle/src/model/Motorcycle.java b/Vehicle/src/model/Motorcycle.java index 1102c48..5134478 100644 --- a/Vehicle/src/model/Motorcycle.java +++ b/Vehicle/src/model/Motorcycle.java @@ -1,57 +1,111 @@ package model; /** + * Represents a Motorcycle with properties such as year, make, and model. + * This class provides methods to get and set these properties, as well as + * methods for generating noise and obtaining a string representation of the motorcycle. + * * @author Corbin Goodman - cgoodman4 * CIS175 - Fall 2023 * Aug 29, 2023 */ +public class Motorcycle { -public class Motorcycle{ - private int year; - private String make; - private String model; - - public Motorcycle() { - super(); - } - - public Motorcycle(int year, String make, String model) { - this.year = year; - this.make = make; - this.model = model; - } - - public int getYear() { - return year; - } - - public void setYear(int year) { - this.year = year; - } - - public String getMake() { - return make; - } - - public void setMake(String make) { - this.make = make; - } - - public String getModel() { - return model; - } - - public void setModel(String model) { - this.model = model; - } - - @Override - public String toString() { - return String.format("This motorcycle is a %d %s %s",this.year,this.make,this.model); - } - - public String makeNoise() { - return "vroom vroom"; - } -} + // Fields representing the properties of the motorcycle + private int year; // The year of the motorcycle + private String make; // The make (brand) of the motorcycle + private String model; // The model name of the motorcycle + + /** + * Default constructor to create an empty Motorcycle object. + */ + public Motorcycle() { + super(); + } + + /** + * Constructs a Motorcycle object with the provided year, make, and model. + * + * @param year The year of the motorcycle + * @param make The make (brand) of the motorcycle + * @param model The model name of the motorcycle + */ + public Motorcycle(int year, String make, String model) { + this.year = year; + this.make = make; + this.model = model; + } + + /** + * Get the year of the motorcycle. + * + * @return The year of the motorcycle + */ + public int getYear() { + return year; + } + + /** + * Set the year of the motorcycle. + * + * @param year The year of the motorcycle + */ + public void setYear(int year) { + this.year = year; + } + + /** + * Get the make (brand) of the motorcycle. + * + * @return The make of the motorcycle + */ + public String getMake() { + return make; + } + /** + * Set the make (brand) of the motorcycle. + * + * @param make The make of the motorcycle + */ + public void setMake(String make) { + this.make = make; + } + + /** + * Get the model name of the motorcycle. + * + * @return The model name of the motorcycle + */ + public String getModel() { + return model; + } + + /** + * Set the model name of the motorcycle. + * + * @param model The model name of the motorcycle + */ + public void setModel(String model) { + this.model = model; + } + + /** + * Generate a string representation of the motorcycle. + * + * @return A formatted string describing the motorcycle + */ + @Override + public String toString() { + return String.format("This motorcycle is a %d %s %s", this.year, this.make, this.model); + } + + /** + * Generate the sound of the motorcycle engine. + * + * @return The sound of the motorcycle engine + */ + public String makeNoise() { + return "vroom vroom"; + } +} From 44f64ca0d801cf1295e8de3949d6f83361d2ed4c Mon Sep 17 00:00:00 2001 From: Corbin Goodman <32312484+Pyr0morpher@users.noreply.github.com> Date: Tue, 29 Aug 2023 18:29:20 -0500 Subject: [PATCH 4/4] Update Motorcycle.java added 'super();' to parameterized constructor --- Vehicle/src/model/Motorcycle.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Vehicle/src/model/Motorcycle.java b/Vehicle/src/model/Motorcycle.java index 5134478..5a9c0c0 100644 --- a/Vehicle/src/model/Motorcycle.java +++ b/Vehicle/src/model/Motorcycle.java @@ -31,6 +31,7 @@ public Motorcycle() { * @param model The model name of the motorcycle */ public Motorcycle(int year, String make, String model) { + super(); this.year = year; this.make = make; this.model = model;