diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..30cf57e
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,10 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Ignored default folder with query files
+/queries/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/lab-java-interfaces-and-abstract-classes.iml b/.idea/lab-java-interfaces-and-abstract-classes.iml
new file mode 100644
index 0000000..c90834f
--- /dev/null
+++ b/.idea/lab-java-interfaces-and-abstract-classes.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..529c55e
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..ff55171
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index ce069b6..5dc9995 100644
--- a/README.md
+++ b/README.md
@@ -1,339 +1,54 @@
-
-
# LAB Java | Interfaces and Abstract Classes
-## Introduction
-
-We have just learned how to create and implement interfaces as well as how to create and extend abstract classes so now let's practice a bit.
-
-
-
-## Requirements
-
-1. Fork this repo.
-2. Clone this repo.
-3. Add your instructor and the class graders as collaborators to your repository. If you are unsure who your class graders are, ask your instructor or refer to the day 1 slide deck.
-4. In the repository, create a Java project and add the code for the following prompts.
-
-## Submission
-
-Once you finish the assignment, submit a URL link to your repository or your pull request in the field below.
-
-
-
-## Instructions
-
-### BigDecimal Operations
-
-1. Using the [BigDecimal documentation](https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html), create a method that accepts a `BigDecimal` and returns a `double` of the `BigDecimal` number rounded to the nearest hundredth. For example, `4.2545` should return `4.25`.
-2. Using the [BigDecimal documentation](https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html), create a method that accepts a `BigDecimal`, reverses the sign (if the parameter is positive, the result should be negative and vice versa), rounds the number to the nearest tenth and returns the result. For example, `1.2345` should return `-1.2` and `-45.67` should return `45.7`.
-
-
-
-### Car Inventory System
-
-1. Suppose you are building a car inventory system. All cars have a `vinNumber`, `make`, `model` and `mileage`. But no car is just a car. Each car is either a `Sedan`, a `UtilityVehicle` or a `Truck`.
-2. Create an abstract class named `Car` and define the following properties and behaviors:
- - `vinNumber`: a `String` representing the VIN number of the car
- - `make`: a `String` representing the make of the car
- - `model`: a `String` representing the model of the car
- - `mileage`: an `int` representing the mileage of the car
- - `getInfo()`: a method that returns a `String` containing all of the car's properties in a readable format
-3. Create three classes that extend `Car`: `Sedan`, `UtilityVehicle` and `Truck`.
-4. `UtilityVehicle` objects should have an additional `fourWheelDrive` property, a `boolean` that represents whether the vehicle has four-wheel drive.
-5. `Truck` objects should have an additional `towingCapacity` property, a `double` that represents the towing capacity of the truck.
-
-
-
-### Video Streaming Service
-
-1. Suppose you are building a video streaming service. All videos are either TV series or movies.
-2. Create an abstract class named `Video` and define the following properties and behaviors:
- - `title`: a `String` representing the title of the video
- - `duration`: an `int` representing the duration of the video in minutes
- - `getInfo()`: a method that returns a `String` containing all of the video's properties in a readable format
-3. Create two classes that extend `Video`: `TvSeries` and `Movie`.
-4. `TvSeries` objects should have an additional `episodes` property, an `int` representing the number of episodes in the series.
-5. `Movie` objects should have an additional `rating` property, a `double` representing the rating of the movie.
-
-
-
-### IntList Interface
-
-1. Create an `IntList` interface with the following methods:
- - `add(int number)`: a method that adds a new number to the list
- - `get(int id)`: a method that retrieves an element by its ID
-2. Create two implementations of `IntList`: `IntArrayList` and `IntVector`.
-3. `IntArrayList` should store numbers in an array with a length of 10 by default. When the `add` method is called, you must first determine if the array is full. If it is, create a new array that is 50% larger, move all elements over to the new array and add the new element. (For example, an array of length 10 would be increased to 15.)
-4. `IntVector` should store numbers in an array with a length of 20 by default. When the `add` method is called, you must first determine if the array is full. If it is, create a new array that is double the size of the current array, move all elements over to the new array and add the new element. (For example, an array of length 10 would be increased to 20.)
-5. In your `README.md`, include an example of when `IntArrayList` would be more efficient and when `IntVector` would be more efficient.
-
-
-
-## FAQs
-
-
-
-
- I am stuck and don't know how to solve the problem or where to start. What should I do?
-
-
-
- If you are stuck in your code and don't know how to solve the problem or where to start, you should take a step back and try to form a clear, straightforward question about the specific issue you are facing. The process you will go through while trying to define this question will help you narrow down the problem and come up with potential solutions.
-
- For example, are you facing a problem because you don't understand the concept or are you receiving an error message that you don't know how to fix? It is usually helpful to try to state the problem as clearly as possible, including any error messages you are receiving. This can help you communicate the issue to others and potentially get help from classmates or online resources.
-
- Once you have a clear understanding of the problem, you should be able to start working toward the solution.
-
-
-
-
-
-
- How do I create a Maven project in IntelliJ?
-
-
-
- To create a Maven project in IntelliJ, you can follow these steps:
-
- 1. Open IntelliJ IDEA and click the "Create New Project" button.
- 2. In the "New Project" dialog, select "Maven" as the build system.
- 3. Specify the name of the project.
- 4. In the "Project Location" section, specify a location where you want to save your project.
- 5. Select the "Create Git repository" checkbox in order to initialize the git repository upon creation of the project.
- 6. Click the "Create" button to create the Maven project.
-
-
-
-
-
-
- How do I use "BigDecimal" in Java to handle precise decimal numbers?
-
-
-
- `BigDecimal` is a class in Java that provides support for precise decimal numbers, allowing you to perform arithmetic operations with arbitrary precision.
-
- Here's how you can use `BigDecimal` in a Java program:
-
- ```java
- import java.math.BigDecimal;
-
- public class BigDecimalExample {
- public static void main(String[] args) {
- BigDecimal a = new BigDecimal("0.1");
- BigDecimal b = new BigDecimal("0.2");
- BigDecimal c = a.add(b);
- System.out.println("a + b = " + c);
- }
- }
- ```
-
- In this example, `BigDecimal` objects are created using the `new` keyword and a string representation of the decimal number. The `add` method is then used to perform arithmetic operations on the `BigDecimal` objects, providing precise results.
-
- It's important to note that when creating a `BigDecimal` object, it's recommended to use the string constructor instead of the `double` constructor. The `double` constructor is not recommended for creating `BigDecimal` objects because the `double` data type has limited precision and may produce unexpected results.
-
- In addition to the `add` method, `BigDecimal` also provides other arithmetic operations, such as `subtract`, `multiply` and `divide`, as well as methods for rounding and formatting the decimal number.
-
-
-
-
-
-
- How do I use "setScale()", "RoundingMode" and "negate()" in Java with "BigDecimal"?
-
-
-
- `setScale()`, `RoundingMode` and `negate()` are methods in the `BigDecimal` class in Java that provide additional functionality when working with precise decimal numbers.
-
- `setScale()` is used to set the scale of a `BigDecimal` object, which determines the number of decimal places to keep. For example:
-
- ```java
- import java.math.BigDecimal;
-
- public class BigDecimalExample {
- public static void main(String[] args) {
- BigDecimal a = new BigDecimal("1.234567");
- BigDecimal b = a.setScale(4, BigDecimal.ROUND_HALF_UP);
- System.out.println("a: " + a);
- System.out.println("b: " + b);
- }
- }
- ```
-
- In this example, `setScale()` is used to set the scale of `a` to 4 decimal places and the result is stored in a new `BigDecimal` object, `b`. The `ROUND_HALF_UP` argument specifies the rounding mode to use when setting the scale.
-
- `RoundingMode` is an enumeration in Java that defines the different rounding modes that can be used with `BigDecimal`. For example:
-
- ```java
- import java.math.BigDecimal;
- import java.math.RoundingMode;
-
- public class BigDecimalExample {
- public static void main(String[] args) {
- BigDecimal a = new BigDecimal("1.234567");
- BigDecimal b = a.setScale(4, RoundingMode.HALF_UP);
- System.out.println("a: " + a);
- System.out.println("b: " + b);
- }
- }
- ```
-
- In this example, `RoundingMode.HALF_UP` is used as the rounding mode argument in the `setScale()` method.
-
- `negate()` is used to negate the value of a `BigDecimal` object, converting a positive value to a negative and vice versa. For example:
-
- ```java
- import java.math.BigDecimal;
-
- public class BigDecimalExample {
- public static void main(String[] args) {
- BigDecimal a = new BigDecimal("1.234567");
- BigDecimal b = a.negate();
- System.out.println("a: " + a);
- System.out.println("b: " + b);
- }
- }
- ```
-
- In this example, `negate()` is used to negate the value of `a` and store the result in a new `BigDecimal` object, `b`.
-
-
-
-
-
-
- What is an abstract class in Java and how is it used?
-
-
-
- An abstract class in Java is a class that cannot be instantiated and is intended to be subclassed by other classes. Abstract classes can contain abstract methods, which are methods that are declared but do not have a body.
-
- An abstract class is used as a base class to provide a common interface and implementation to its subclasses. Subclasses of an abstract class must implement the abstract methods defined in the abstract class.
-
- Here is an example of an abstract class in Java:
-
- ```java
- abstract class Shape {
- int x, y;
- // abstract method that subclasses must implement
- abstract void draw();
- }
-
- class Circle extends Shape {
- @Override
- void draw() {
- System.out.println("Drawing a circle");
- }
- }
-
- class Square extends Shape {
- @Override
- void draw() {
- System.out.println("Drawing a square");
- }
- }
- ```
-
- In this example, the `Shape` class is an abstract class that contains an abstract method `draw()`. The `Circle` and `Square` classes are subclasses of `Shape` and implement the `draw()` method.
-
- When a subclass implements the abstract methods of its abstract class, it inherits the properties and methods of the abstract class, making it easier to implement common functionality in multiple classes.
-
-
-
-
-
-
- How do I implement an interface in Java?
-
-
-
- In Java, an interface is a blueprint for classes that outlines the methods that a class must implement. To implement an interface, you need to create a class that implements the interface and provides an implementation for each of its methods.
-
- Here is an example of how to implement an interface in Java:
-
- ```java
- interface Shape {
- void draw();
- }
-
- class Circle implements Shape {
- @Override
- public void draw() {
- System.out.println("Drawing a circle");
- }
- }
-
- class Square implements Shape {
- @Override
- public void draw() {
- System.out.println("Drawing a square");
- }
- }
- ```
-
- In this example, the `Shape` interface defines a single method `draw()`. The `Circle` and `Square` classes implement the `Shape` interface by providing an implementation for the `draw()` method.
-
- When a class implements an interface, it must implement all the methods defined in the interface. If a class does not implement all the methods, it will not compile. Interfaces can be used to enforce a common set of methods in a group of classes, making it easier to write code that is interchangeable between different classes that implement the same interface.
-
-
-
-
-
-
- What is the purpose of "System.arraycopy()" in Java and how do we use it?
-
-
-
- The `System.arraycopy()` method in Java is used to copy elements from one array to another. It is part of the `System` class and provides a faster alternative to the traditional for loop method of copying arrays. The method has the following signature:
-
- ```java
- public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
- ```
-
- Here's an example of how you can use `System.arraycopy()`:
-
- ```java
- int[] sourceArray = new int[] {1, 2, 3, 4, 5};
- int[] destinationArray = new int[5];
- System.arraycopy(sourceArray, 0, destinationArray, 0, sourceArray.length);
-
- System.out.println(Arrays.toString(destinationArray));
- ```
-
- In this example, `System.arraycopy()` is used to copy the elements of `sourceArray` to `destinationArray`. The first argument `src` is the source array, the second argument `srcPos` is the starting position in the source array, the third argument `dest` is the destination array, the fourth argument `destPos` is the starting position in the destination array and the fifth argument `length` is the number of elements to be copied. The output of this example would be `[1, 2, 3, 4, 5]`.
+## Solution by LirSA6CW
-
+---
-
+## Structure
-
- I am unable to push changes to my repository. What should I do?
+| File | Description |
+|------|-------------|
+| B01_Main.java | Entry point — runs all sections |
+| B02_BigDecimalUtils.java | Section 1 — BigDecimal operations |
+| B03_Car.java | Section 2 — Abstract base class Car |
+| B04_Sedan.java | Section 2 — Sedan subclass |
+| B05_UtilityVehicle.java | Section 2 — UtilityVehicle subclass |
+| B06_Truck.java | Section 2 — Truck subclass |
+| B07_Video.java | Section 3 — Abstract base class Video |
+| B08_TvSeries.java | Section 3 — TvSeries subclass |
+| B09_Movie.java | Section 3 — Movie subclass |
+| B10_IntList.java | Section 4 — IntList interface |
+| B11_IntArrayList.java | Section 4 — IntArrayList implementation |
+| B12_IntVector.java | Section 4 — IntVector implementation |
-
+---
- If you are unable to push changes to your repository, here are a few steps that you can follow:
+## IntArrayList vs IntVector — When to use each
- 1. Check your internet connection: Ensure that your internet connection is stable and working.
- 1. Verify your repository URL: Make sure that you are using the correct repository URL to push your changes.
- 2. Check Git credentials: Ensure that your Git credentials are up-to-date and correct. You can check your credentials using the following command:
+### IntArrayList (grows by 50%)
- ```bash
- git config --list
- ```
+**Use when:**
+- The number of elements is relatively small and somewhat predictable.
+- Memory efficiency matters — growing by 50% wastes less space than doubling.
+- Elements are added in bursts followed by long periods of stability.
- 4. Update your local repository: Before pushing changes, make sure that your local repository is up-to-date with the remote repository. You can update your local repository using the following command:
+**Example:** A list of items in a shopping cart. Most users add between 5 and 20 items. Starting at 10 and growing to 15 is sufficient and avoids allocating unnecessary memory.
- ```bash
- git fetch origin
- ```
+### IntVector (doubles in size)
- 5. Check for conflicts: If there are any conflicts between your local repository and the remote repository, resolve them before pushing changes.
- 6. Push changes: Once you have resolved any conflicts and updated your local repository, you can try pushing changes again using the following command:
+**Use when:**
+- A large and unpredictable number of elements will be added continuously.
+- Performance is critical — doubling minimizes the number of resize operations.
+- Speed of insertion matters more than memory usage.
- ```bash
- git push origin
- ```
+**Example:** A real-time sensor logging system recording thousands of readings per second. Doubling the array size each time it fills keeps resize operations rare, avoiding performance bottlenecks.
-
+### Summary
+| | IntArrayList | IntVector |
+|---|---|---|
+| Default capacity | 10 | 20 |
+| Growth factor | 50% | 100% (doubles) |
+| Memory efficiency | Better | Worse |
+| Resize frequency | Higher | Lower |
+| Best for | Small, predictable datasets | Large, fast-growing datasets |
\ No newline at end of file
diff --git a/out/production/lab-java-interfaces-and-abstract-classes/B01_Main.class b/out/production/lab-java-interfaces-and-abstract-classes/B01_Main.class
new file mode 100644
index 0000000..80969d1
Binary files /dev/null and b/out/production/lab-java-interfaces-and-abstract-classes/B01_Main.class differ
diff --git a/out/production/lab-java-interfaces-and-abstract-classes/B02_BigDecimalUtils.class b/out/production/lab-java-interfaces-and-abstract-classes/B02_BigDecimalUtils.class
new file mode 100644
index 0000000..206f457
Binary files /dev/null and b/out/production/lab-java-interfaces-and-abstract-classes/B02_BigDecimalUtils.class differ
diff --git a/out/production/lab-java-interfaces-and-abstract-classes/B03_Car.class b/out/production/lab-java-interfaces-and-abstract-classes/B03_Car.class
new file mode 100644
index 0000000..c234e17
Binary files /dev/null and b/out/production/lab-java-interfaces-and-abstract-classes/B03_Car.class differ
diff --git a/out/production/lab-java-interfaces-and-abstract-classes/B04_Sedan.class b/out/production/lab-java-interfaces-and-abstract-classes/B04_Sedan.class
new file mode 100644
index 0000000..83f30fe
Binary files /dev/null and b/out/production/lab-java-interfaces-and-abstract-classes/B04_Sedan.class differ
diff --git a/out/production/lab-java-interfaces-and-abstract-classes/B05_UtilityVehicle.class b/out/production/lab-java-interfaces-and-abstract-classes/B05_UtilityVehicle.class
new file mode 100644
index 0000000..5a147a1
Binary files /dev/null and b/out/production/lab-java-interfaces-and-abstract-classes/B05_UtilityVehicle.class differ
diff --git a/out/production/lab-java-interfaces-and-abstract-classes/B06_Truck.class b/out/production/lab-java-interfaces-and-abstract-classes/B06_Truck.class
new file mode 100644
index 0000000..7a78abe
Binary files /dev/null and b/out/production/lab-java-interfaces-and-abstract-classes/B06_Truck.class differ
diff --git a/out/production/lab-java-interfaces-and-abstract-classes/B07_Video.class b/out/production/lab-java-interfaces-and-abstract-classes/B07_Video.class
new file mode 100644
index 0000000..c55b9c7
Binary files /dev/null and b/out/production/lab-java-interfaces-and-abstract-classes/B07_Video.class differ
diff --git a/out/production/lab-java-interfaces-and-abstract-classes/B08_TvSeries.class b/out/production/lab-java-interfaces-and-abstract-classes/B08_TvSeries.class
new file mode 100644
index 0000000..6de421f
Binary files /dev/null and b/out/production/lab-java-interfaces-and-abstract-classes/B08_TvSeries.class differ
diff --git a/out/production/lab-java-interfaces-and-abstract-classes/B09_Movie.class b/out/production/lab-java-interfaces-and-abstract-classes/B09_Movie.class
new file mode 100644
index 0000000..53bdd4e
Binary files /dev/null and b/out/production/lab-java-interfaces-and-abstract-classes/B09_Movie.class differ
diff --git a/out/production/lab-java-interfaces-and-abstract-classes/B10_IntList.class b/out/production/lab-java-interfaces-and-abstract-classes/B10_IntList.class
new file mode 100644
index 0000000..e624ecd
Binary files /dev/null and b/out/production/lab-java-interfaces-and-abstract-classes/B10_IntList.class differ
diff --git a/out/production/lab-java-interfaces-and-abstract-classes/B11_IntArrayList.class b/out/production/lab-java-interfaces-and-abstract-classes/B11_IntArrayList.class
new file mode 100644
index 0000000..0e6945a
Binary files /dev/null and b/out/production/lab-java-interfaces-and-abstract-classes/B11_IntArrayList.class differ
diff --git a/out/production/lab-java-interfaces-and-abstract-classes/B12_IntVector.class b/out/production/lab-java-interfaces-and-abstract-classes/B12_IntVector.class
new file mode 100644
index 0000000..d820c3d
Binary files /dev/null and b/out/production/lab-java-interfaces-and-abstract-classes/B12_IntVector.class differ
diff --git a/src/A_BigDecimal_Operations/B02_BigDecimalUtils.java b/src/A_BigDecimal_Operations/B02_BigDecimalUtils.java
new file mode 100644
index 0000000..ad5c8b0
--- /dev/null
+++ b/src/A_BigDecimal_Operations/B02_BigDecimalUtils.java
@@ -0,0 +1,29 @@
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+/**
+ * B02_BigDecimalUtils — Utility methods for BigDecimal operations.
+ * Section 1 of the lab.
+ */
+public class B02_BigDecimalUtils {
+
+ /**
+ * Rounds a BigDecimal to the nearest hundredth (2 decimal places).
+ * Example: 4.2545 -> 4.25
+ * @param value the BigDecimal to round
+ * @return a double rounded to 2 decimal places
+ */
+ public static double roundToHundredth(BigDecimal value) {
+ return value.setScale(2, RoundingMode.HALF_UP).doubleValue();
+ }
+
+ /**
+ * Reverses the sign of a BigDecimal and rounds it to the nearest tenth (1 decimal place).
+ * Example: 1.2345 -> -1.2 | -45.67 -> 45.7
+ * @param value the BigDecimal to negate and round
+ * @return a BigDecimal with reversed sign rounded to 1 decimal place
+ */
+ public static BigDecimal negateAndRoundToTenth(BigDecimal value) {
+ return value.negate().setScale(1, RoundingMode.HALF_UP);
+ }
+}
\ No newline at end of file
diff --git a/src/B01_Main.java b/src/B01_Main.java
new file mode 100644
index 0000000..6374451
--- /dev/null
+++ b/src/B01_Main.java
@@ -0,0 +1,50 @@
+import java.math.BigDecimal;
+
+
+/**
+ * B01_Main — Entry point for Lab 3: Interfaces and Abstract Classes.
+ * Runs demonstrations for all four sections.
+ */
+public class B01_Main {
+
+ public static void main(String[] args) {
+
+ // Section 1: BigDecimal Operations
+ System.out.println("=== BigDecimal Operations ===");
+ BigDecimal val1 = new BigDecimal("4.2545");
+ BigDecimal val2 = new BigDecimal("1.2345");
+ BigDecimal val3 = new BigDecimal("-45.67");
+ System.out.println(B02_BigDecimalUtils.roundToHundredth(val1)); // 4.25
+ System.out.println(B02_BigDecimalUtils.negateAndRoundToTenth(val2)); // -1.2
+ System.out.println(B02_BigDecimalUtils.negateAndRoundToTenth(val3)); // 45.7
+
+ // Section 2: Car Inventory System
+ System.out.println("\n=== Car Inventory System ===");
+ B04_Sedan sedan = new B04_Sedan("1HGCM82633A123456", "Honda", "Civic", 45000);
+ B05_UtilityVehicle suv = new B05_UtilityVehicle("2T1BURHE0JC123456", "Toyota", "RAV4", 30000, true);
+ B06_Truck truck = new B06_Truck("3GCUKREC0EG123456", "Chevrolet", "Silverado", 60000, 12000.0);
+ System.out.println(sedan.getInfo());
+ System.out.println(suv.getInfo());
+ System.out.println(truck.getInfo());
+
+ // Section 3: Video Streaming Service
+ System.out.println("\n=== Video Streaming Service ===");
+ B08_TvSeries series = new B08_TvSeries("Breaking Bad", 2700, 62);
+ B09_Movie movie = new B09_Movie("Inception", 148, 8.8);
+ System.out.println(series.getInfo());
+ System.out.println(movie.getInfo());
+
+ // Section 4: IntList Interface
+ System.out.println("\n=== IntList Interface ===");
+ B11_IntArrayList arrayList = new B11_IntArrayList();
+ B12_IntVector vector = new B12_IntVector();
+
+ for (int i = 0; i < 12; i++) {
+ arrayList.add(i * 10);
+ vector.add(i * 5);
+ }
+
+ System.out.println("IntArrayList element at index 5: " + arrayList.get(5));
+ System.out.println("IntVector element at index 5: " + vector.get(5));
+ }
+}
\ No newline at end of file
diff --git a/src/B_Car_Inventory_System/B03_Car.java b/src/B_Car_Inventory_System/B03_Car.java
new file mode 100644
index 0000000..5b6014a
--- /dev/null
+++ b/src/B_Car_Inventory_System/B03_Car.java
@@ -0,0 +1,39 @@
+/**
+ * B03_Car — Abstract base class for all car types in the inventory system.
+ * Section 2 of the lab.
+ * Subclasses: B04_Sedan, B05_UtilityVehicle, B06_Truck
+ */
+public abstract class B03_Car {
+
+ private String vinNumber;
+ private String make;
+ private String model;
+ private int mileage;
+
+ public B03_Car(String vinNumber, String make, String model, int mileage) {
+ this.vinNumber = vinNumber;
+ this.make = make;
+ this.model = model;
+ this.mileage = mileage;
+ }
+
+ // --- Getters and Setters ---
+
+ public String getVinNumber() { return vinNumber; }
+ public void setVinNumber(String vinNumber) { this.vinNumber = vinNumber; }
+
+ 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; }
+
+ public int getMileage() { return mileage; }
+ public void setMileage(int mileage) { this.mileage = mileage; }
+
+ /**
+ * Returns a readable string with all car properties.
+ * Each subclass must implement this method.
+ */
+ public abstract String getInfo();
+}
\ No newline at end of file
diff --git a/src/B_Car_Inventory_System/B04_Sedan.java b/src/B_Car_Inventory_System/B04_Sedan.java
new file mode 100644
index 0000000..7a1b6e0
--- /dev/null
+++ b/src/B_Car_Inventory_System/B04_Sedan.java
@@ -0,0 +1,20 @@
+/**
+ * B04_Sedan — Represents a sedan car. Extends B03_Car.
+ * No additional properties beyond the base Car class.
+ */
+public class B04_Sedan extends B03_Car {
+
+ public B04_Sedan(String vinNumber, String make, String model, int mileage) {
+ super(vinNumber, make, model, mileage);
+ }
+
+ @Override
+ public String getInfo() {
+ return "Sedan{" +
+ "vin='" + getVinNumber() + '\'' +
+ ", make='" + getMake() + '\'' +
+ ", model='" + getModel() + '\'' +
+ ", mileage=" + getMileage() +
+ '}';
+ }
+}
diff --git a/src/B_Car_Inventory_System/B05_UtilityVehicle.java b/src/B_Car_Inventory_System/B05_UtilityVehicle.java
new file mode 100644
index 0000000..5a80743
--- /dev/null
+++ b/src/B_Car_Inventory_System/B05_UtilityVehicle.java
@@ -0,0 +1,27 @@
+/**
+ * B05_UtilityVehicle — Represents a utility vehicle (SUV). Extends B03_Car.
+ * Additional property: fourWheelDrive (boolean)
+ */
+public class B05_UtilityVehicle extends B03_Car {
+
+ private boolean fourWheelDrive;
+
+ public B05_UtilityVehicle(String vinNumber, String make, String model, int mileage, boolean fourWheelDrive) {
+ super(vinNumber, make, model, mileage);
+ this.fourWheelDrive = fourWheelDrive;
+ }
+
+ public boolean isFourWheelDrive() { return fourWheelDrive; }
+ public void setFourWheelDrive(boolean fourWheelDrive) { this.fourWheelDrive = fourWheelDrive; }
+
+ @Override
+ public String getInfo() {
+ return "UtilityVehicle{" +
+ "vin='" + getVinNumber() + '\'' +
+ ", make='" + getMake() + '\'' +
+ ", model='" + getModel() + '\'' +
+ ", mileage=" + getMileage() +
+ ", fourWheelDrive=" + fourWheelDrive +
+ '}';
+ }
+}
\ No newline at end of file
diff --git a/src/B_Car_Inventory_System/B06_Truck.java b/src/B_Car_Inventory_System/B06_Truck.java
new file mode 100644
index 0000000..afcc75d
--- /dev/null
+++ b/src/B_Car_Inventory_System/B06_Truck.java
@@ -0,0 +1,27 @@
+/**
+ * B06_Truck — Represents a truck. Extends B03_Car.
+ * Additional property: towingCapacity (double)
+ */
+public class B06_Truck extends B03_Car {
+
+ private double towingCapacity;
+
+ public B06_Truck(String vinNumber, String make, String model, int mileage, double towingCapacity) {
+ super(vinNumber, make, model, mileage);
+ this.towingCapacity = towingCapacity;
+ }
+
+ public double getTowingCapacity() { return towingCapacity; }
+ public void setTowingCapacity(double towingCapacity) { this.towingCapacity = towingCapacity; }
+
+ @Override
+ public String getInfo() {
+ return "Truck{" +
+ "vin='" + getVinNumber() + '\'' +
+ ", make='" + getMake() + '\'' +
+ ", model='" + getModel() + '\'' +
+ ", mileage=" + getMileage() +
+ ", towingCapacity=" + towingCapacity +
+ '}';
+ }
+}
\ No newline at end of file
diff --git a/src/C_Video_Streaming_Service/B07_Video.java b/src/C_Video_Streaming_Service/B07_Video.java
new file mode 100644
index 0000000..1e3e374
--- /dev/null
+++ b/src/C_Video_Streaming_Service/B07_Video.java
@@ -0,0 +1,29 @@
+/**
+ * B07_Video — Abstract base class for all video types in the streaming service.
+ * Section 3 of the lab.
+ * Subclasses: B08_TvSeries, B09_Movie
+ */
+public abstract class B07_Video {
+
+ private String title;
+ private int duration; // in minutes
+
+ public B07_Video(String title, int duration) {
+ this.title = title;
+ this.duration = duration;
+ }
+
+ // --- Getters and Setters ---
+
+ public String getTitle() { return title; }
+ public void setTitle(String title) { this.title = title; }
+
+ public int getDuration() { return duration; }
+ public void setDuration(int duration) { this.duration = duration; }
+
+ /**
+ * Returns a readable string with all video properties.
+ * Each subclass must implement this method.
+ */
+ public abstract String getInfo();
+}
\ No newline at end of file
diff --git a/src/C_Video_Streaming_Service/B08_TvSeries.java b/src/C_Video_Streaming_Service/B08_TvSeries.java
new file mode 100644
index 0000000..31c17b3
--- /dev/null
+++ b/src/C_Video_Streaming_Service/B08_TvSeries.java
@@ -0,0 +1,25 @@
+/**
+ * B08_TvSeries — Represents a TV series. Extends B07_Video.
+ * Additional property: episodes (int)
+ */
+public class B08_TvSeries extends B07_Video {
+
+ private int episodes;
+
+ public B08_TvSeries(String title, int duration, int episodes) {
+ super(title, duration);
+ this.episodes = episodes;
+ }
+
+ public int getEpisodes() { return episodes; }
+ public void setEpisodes(int episodes) { this.episodes = episodes; }
+
+ @Override
+ public String getInfo() {
+ return "TvSeries{" +
+ "title='" + getTitle() + '\'' +
+ ", duration=" + getDuration() + "min" +
+ ", episodes=" + episodes +
+ '}';
+ }
+}
\ No newline at end of file
diff --git a/src/C_Video_Streaming_Service/B09_Movie.java b/src/C_Video_Streaming_Service/B09_Movie.java
new file mode 100644
index 0000000..24a3539
--- /dev/null
+++ b/src/C_Video_Streaming_Service/B09_Movie.java
@@ -0,0 +1,25 @@
+/**
+ * B09_Movie — Represents a movie. Extends B07_Video.
+ * Additional property: rating (double)
+ */
+public class B09_Movie extends B07_Video {
+
+ private double rating;
+
+ public B09_Movie(String title, int duration, double rating) {
+ super(title, duration);
+ this.rating = rating;
+ }
+
+ public double getRating() { return rating; }
+ public void setRating(double rating) { this.rating = rating; }
+
+ @Override
+ public String getInfo() {
+ return "Movie{" +
+ "title='" + getTitle() + '\'' +
+ ", duration=" + getDuration() + "min" +
+ ", rating=" + rating +
+ '}';
+ }
+}
\ No newline at end of file
diff --git a/src/D_IntList_Interface/B10_IntList.java b/src/D_IntList_Interface/B10_IntList.java
new file mode 100644
index 0000000..acacf86
--- /dev/null
+++ b/src/D_IntList_Interface/B10_IntList.java
@@ -0,0 +1,21 @@
+/**
+ * B10_IntList — Interface defining the contract for integer list implementations.
+ * Section 4 of the lab.
+ * Implementations: B11_IntArrayList, B12_IntVector
+ */
+public interface B10_IntList {
+
+ /**
+ * Adds a new integer to the list.
+ * Implementations must handle array resizing when full.
+ * @param number the integer to add
+ */
+ void add(int number);
+
+ /**
+ * Retrieves an element by its index.
+ * @param id the index of the element
+ * @return the integer at the given index
+ */
+ int get(int id);
+}
\ No newline at end of file
diff --git a/src/D_IntList_Interface/B11_IntArrayList.java b/src/D_IntList_Interface/B11_IntArrayList.java
new file mode 100644
index 0000000..afc5285
--- /dev/null
+++ b/src/D_IntList_Interface/B11_IntArrayList.java
@@ -0,0 +1,43 @@
+/**
+ * B11_IntArrayList — Implements B10_IntList using a dynamic array.
+ * Default capacity: 10. When full, grows by 50% (e.g. 10 -> 15 -> 22).
+ *
+ * More efficient than IntVector when:
+ * - The number of elements is relatively small and predictable.
+ * - Memory usage needs to be minimized (smaller growth factor = less wasted space).
+ * - Elements are added infrequently after the initial fill.
+ */
+public class B11_IntArrayList implements B10_IntList {
+
+ private int[] data;
+ private int size; // number of elements currently stored
+
+ public B11_IntArrayList() {
+ data = new int[10]; // default capacity
+ size = 0;
+ }
+
+ /**
+ * Adds a new integer. If the array is full, grows by 50% before adding.
+ */
+ @Override
+ public void add(int number) {
+ if (size == data.length) {
+ // Array is full: grow by 50%
+ int newCapacity = (int) (data.length * 1.5);
+ int[] newData = new int[newCapacity];
+ System.arraycopy(data, 0, newData, 0, data.length);
+ data = newData;
+ }
+ data[size] = number;
+ size++;
+ }
+
+ /**
+ * Returns the element at the given index.
+ */
+ @Override
+ public int get(int id) {
+ return data[id];
+ }
+}
\ No newline at end of file
diff --git a/src/D_IntList_Interface/B12_IntVector.java b/src/D_IntList_Interface/B12_IntVector.java
new file mode 100644
index 0000000..3fb43ba
--- /dev/null
+++ b/src/D_IntList_Interface/B12_IntVector.java
@@ -0,0 +1,42 @@
+/**
+ * B12_IntVector — Implements B10_IntList using a dynamic array.
+ * Default capacity: 20. When full, doubles in size (e.g. 20 -> 40 -> 80).
+ *
+ * More efficient than IntArrayList when:
+ * - A large number of elements will be added frequently.
+ * - Performance is critical and resizing operations must be minimized.
+ * - The number of elements is unpredictable and could grow rapidly.
+ */
+public class B12_IntVector implements B10_IntList {
+
+ private int[] data;
+ private int size; // number of elements currently stored
+
+ public B12_IntVector() {
+ data = new int[20]; // default capacity
+ size = 0;
+ }
+
+ /**
+ * Adds a new integer. If the array is full, doubles its size before adding.
+ */
+ @Override
+ public void add(int number) {
+ if (size == data.length) {
+ // Array is full: double the size
+ int[] newData = new int[data.length * 2];
+ System.arraycopy(data, 0, newData, 0, data.length);
+ data = newData;
+ }
+ data[size] = number;
+ size++;
+ }
+
+ /**
+ * Returns the element at the given index.
+ */
+ @Override
+ public int get(int id) {
+ return data[id];
+ }
+}
\ No newline at end of file