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 .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.metadata/
9 changes: 9 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"ExpandedNodes": [
"",
"\\ClassClass",
"\\ClassClass\\src"
],
"SelectedNode": "\\ClassClass\\src\\ClassClass.java",
"PreviewInSolutionExplorer": false
}
Binary file added .vs/dell-java/v15/.suo
Binary file not shown.
Binary file added .vs/slnx.sqlite
Binary file not shown.
6 changes: 6 additions & 0 deletions ArrayVList/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions ArrayVList/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions ArrayVList/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ArrayVList</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions ArrayVList/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
130 changes: 130 additions & 0 deletions ArrayVList/src/ArrayVList/ArrayVList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
package ArrayVList;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class ArrayVList {
public static void main(String[] args) {
String StringOfColors[] = {"red","blue","yellow"};

for (int i = 0; i < StringOfColors.length; i++)
System.out.println(StringOfColors[i]);

//just showing a two dimensional array
String[][] twoDArray = new String[3][3];

/* very specific because I say ArrayList rather than just List. a "special type of lightbulb"*/
ArrayList<String> listOfColors = new ArrayList<String>();

/*I want a just a light bulb, any kind*/
List<String> listOfColors2 = new ArrayList<String>();

listOfColors.add("red");
listOfColors.add("blue");
listOfColors.add("yellow");
System.out.println("Hey Matt, it's future matt. Just checking in. Stay safe. Cheers.");
System.out.println("Do you have anything to say to him?");
Scanner reader = new Scanner(System.in);
String yourPick = reader.nextLine();
reader.close();
System.out.println('"'+ yourPick + '"');
System.out.println("me too, thanks");

//just examples of getting size and getting specific value of array location
int s = listOfColors2.size();
String blue = listOfColors.get(1);

MyList colors = new MyList();

colors.add("Yellow");
colors.add("Blue");
colors.add("Red");
colors.add("Green");
colors.add("Black");

for (int i = 0; i < colors.size(); i++) {
System.out.println(i + " " + colors.get(i));
}

String red = colors.get(2);
int s2 = colors.size();

colors.remove(4);

for (int i = 0; i < StringOfColors.length; i++) {
System.out.println(i + " " + colors.get(i));
}

}

public static class MyList {

String[] store = new String[10];
int size = 0;

/**
* Adds a string to the list
* @param s the string to add to the list
*/
public void add(String s) {
//figure out the add logic

if(size == store.length) {
String[] tmp = new String[size+10];

for(int i = 0; i < store.length; i++) {
tmp[i] = store[i];
}

store = tmp;

}
store[size] = s;

size += 1;

}

/**
* Returns the current size of the list
* @return the current size of the list
*/
public int size() {
return size;
}

/**
* Returns the string at the position passed in
* @param i the position passed in
* @return the string at the position
*/
public String get(int i) {
return store[i];
}

/**
* Removes the element from the list at the given position
* @param i the position to remove from the list
*/
public void remove(int i) {
//figure out the remove element logic
if(i > size) {
return;
} else {
String[] tmp = new String[size];
for(int j = 0; j < size-1; i++) {
if(j != i) {
tmp[j] = store[i];
}
}

store = tmp;
store[size] = null;
size -= 1;
}

}
}


}
6 changes: 6 additions & 0 deletions Calculator/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions Calculator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions Calculator/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Calculator</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions Calculator/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
Binary file added Calculator/bin/Calc/Calculator.class
Binary file not shown.
48 changes: 48 additions & 0 deletions Calculator/src/Calc/Calculator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package Calc;
import java.util.Scanner;

public class Calculator {
public static void main(String[] args) {
System.out.println("Please enter first number.");

Scanner reader = new Scanner(System.in);
int firstNum = Integer.parseInt(reader.nextLine());

System.out.println("Please enter second number.");

int secondNum = Integer.parseInt(reader.nextLine());
reader.close();

int add = addition(firstNum, secondNum);
int sub = subtract(firstNum, secondNum);
int mult = multiply(firstNum, secondNum);
int quotient = quotient(firstNum, secondNum);

System.out.println("Add: " + add);
System.out.println("Subtract: " + sub);
System.out.println("Multiply: " + mult);
System.out.println("Divide: " + quotient);

}

public static int addition(int firstNum, int secondNum) {
int result = firstNum + secondNum;
return result;
}

public static int subtract(int firstNum, int secondNum) {
int result = firstNum - secondNum;
return result;
}

public static int multiply(int firstNum, int secondNum) {
int result = firstNum * secondNum;
return result;
}

public static int quotient(int firstNum, int secondNum) {
int result = firstNum / secondNum;
return result;
}

}
6 changes: 6 additions & 0 deletions CarLots/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions CarLots/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions CarLots/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>CarLots</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions CarLots/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
42 changes: 42 additions & 0 deletions CarLots/src/Car.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* type (coupe, hatchback, or sedan)
number of doors
*/
public class Car extends Vehicle {

private CarType type;
private int numDoors;

/*
* car constructor that gets 4 attributes from parent super class and has to assign two attributes of its own
*/
public Car(String licenseNum, String make, String model, double price, CarType type, int numDoors) {
super(licenseNum, make, model, price);
this.type = type;
this.numDoors = numDoors;
}

@Override
public String basicDetails() {
return "Car is a " + getType() + " and has " + getNumDoors() + " doors.";
}

public CarType getType() {
return type;
}

public void setType(CarType type) {
this.type = type;
}

public int getNumDoors() {
return numDoors;
}

public void setNumDoors(int numDoors) {
this.numDoors = numDoors;
}



}
Loading