Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c00f8cb
initial commit
rohinsood Jul 4, 2022
b85b6ab
abstraction activity
rohinsood Jul 4, 2022
b9ba71f
fix wording
rohinsood Jul 4, 2022
c993fbc
getDescription()
rohinsood Jul 4, 2022
20fd416
Create inheritance
rohinsood Jul 4, 2022
e1de50b
update reqs & task
rohinsood Jul 4, 2022
0b1ea18
update isZip
rohinsood Jul 4, 2022
a263306
encapsulation activity
rohinsood Jul 4, 2022
6aff4bb
Update Encapsulation.md
Ple1ades Jul 5, 2022
403dc81
Merge branch 'day3' of https://github.com/Team-Optix-3749/Training-Ex…
rohinsood Jul 5, 2022
6ce5608
Merge branch 'main' into day3
rohinsood Sep 22, 2022
44c7c84
delete printing.md
rohinsood Sep 22, 2022
dc924b6
update PR part of how to use
rohinsood Sep 22, 2022
1984bb7
rename files to README.md
rohinsood Sep 22, 2022
0ef4716
Merge branch 'main' into day3
rohinsood Sep 25, 2022
0858ded
Merge branch 'main' into day3
rohinsood Sep 25, 2022
e60c250
Move activites into "week 3" and create lambdas 😍
rohinsood Sep 25, 2022
829489f
week 3 homeowrk 😍😍😍😍
rohinsood Sep 25, 2022
2433ec8
Merge branch 'main' into week3
rohinsood Sep 25, 2022
4846cee
fix homework
rohinsood Sep 26, 2022
1b9b716
Removed Robot Homework
NoahSimon8 Jul 16, 2023
8d7e739
Impots and inputs
NoahSimon8 Jul 16, 2023
854f98f
updated week 3
NoahSimon8 Oct 7, 2024
8db1866
removed methods from week 3
NoahSimon8 Oct 7, 2024
17bab67
it kinda works dw about it
JustinQ-DNHS Oct 11, 2024
bb802d7
created class homework
JustinQ-DNHS Oct 17, 2024
99e8115
did the array homework on time
JustinQ-DNHS Oct 18, 2024
f75279c
finished class homework
JustinQ-DNHS Oct 18, 2024
8f94d8a
inheritance activitiy start
JustinQ-DNHS Oct 18, 2024
fd95cd8
did the inheritance homework
JustinQ-DNHS Oct 22, 2024
8cf9044
fixed issue
JustinQ-DNHS Oct 22, 2024
982c345
fixed mistake
JustinQ-DNHS Oct 22, 2024
24f6882
finish the abstraction homework
JustinQ-DNHS Oct 23, 2024
5e1cdf6
polymorphism homework and practuce done
JustinQ-DNHS Oct 23, 2024
da94ca3
added public and private to promote better readability
JustinQ-DNHS Oct 23, 2024
a4d0ba6
finished encapsulation homework
JustinQ-DNHS Oct 23, 2024
76a6bfa
removed white space
JustinQ-DNHS Oct 23, 2024
ac776c4
this breaks stuff
JustinQ-DNHS Oct 24, 2024
d1170f9
fix later
JustinQ-DNHS Oct 24, 2024
04d7e6e
did pokemon work
JustinQ-DNHS Oct 25, 2024
9d83eb4
Update README
JustinQ-DNHS Oct 25, 2024
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
29 changes: 29 additions & 0 deletions Week3/Abstraction/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Abstraction 🍵

### Task 🐧
- Create an abstract class called Shirt:
- Make an instance variable called color
- Make a constructor that takes a String for the color & sets it to the instance variable
- Make a public method called `getColor()` that returns the name of the color
- Make an empty abstract method called `getDescription()`

- Create a default class called `T_Shirt` that extends Shirt:
- Make an instance variable called size
- Make an instance variable called price
- Make a constructor that takes in a color, size, price and sets the instance variables (Use super() to call the constructor of Shirt)
- Override the method called `getDescription()` that returns the color, size, and price of the T_Shirt

- Create another default class called 'Jacket' that extends Shirt:
- Make an instance variable called price
- Make an instance variable called brand
- Make a constructor that takes in a color, and price, and sets the instance variables (Use super() to call the constructor of Shirt)
- Override the method called `getDescription()` that returns the color, brand, and price of the T_Shirt

### Requirements 🏫
```
1. A .java file
2. Prints the color & size of a T_Shirt
3. Prints the color & size of a Jacket
4. Prints the isZip of a Jacket
5. Prints the total price of the items
```
53 changes: 53 additions & 0 deletions Week3/Abstraction/Shirt.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Abstract means that you can't create a object of this class, only it's children
public abstract class Shirt {
public String color;

public Shirt(String color) {
this.color = color;
}

public String getColor() {
return this.color;
}

abstract void getDescription();

public static void main(String[] args) {
Shirt[] myShirt = {new T_Shirt("Blue", "XL:", 29.99), new Jacket("Black", "Adidas", 49.99)};
for (int i = 0; i < myShirt.length; i++) {
myShirt[i].getDescription();
}
}
}

class T_Shirt extends Shirt {
private String size;
private double price;

public T_Shirt(String color, String size, double price) {
super(color);
this.size = size;
this.price = price;
}

@Override
public void getDescription() {
System.out.println("\n\nT-Shirt:\nColor: " + color + "\nSize: " + size + "\nPrice: $" + price);
}
}

class Jacket extends Shirt {
private double price;
private String brand;

public Jacket(String color, String brand, double price) {
super(color);
this.brand = brand;
this.price = price;
}

@Override
public void getDescription() {
System.out.println("\n\nJacket:\nColor: " + color + "\nBraand: " + brand + "\nPrice: $" + price);
}
}
10 changes: 10 additions & 0 deletions Week3/Arrays/Array.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
public class Array {
public static void main(String[] args) {
String[] randomRoboticInformation = {"Software", "blah blah blah"};

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

16 changes: 16 additions & 0 deletions Week3/Arrays/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Arrays 🍵

### Task 🐧
Create code that consists of an array with the following elements:
- An element containing the name of your department
- An element contianing the name of the oldest person in the world
- An element contianing the name of the Rapid React world champion alliance captains
- An element containing the name of the 2019 FRC game

- Then print each element, from last to first.

### Requirements 🏫
```
1. A .java file
2. Creates an array and prints the elements as specified
```
21 changes: 21 additions & 0 deletions Week3/Classes&Objects/Me.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
public class Me {
String name;
int age;

Me(String name, int age) {
this.name = name;
this.age = age;
}
void name() {
System.out.println(this.name);
}
void age() {
System.out.println(this.age);
}

public static void main(String[] args) {
Me justin = new Me("Justin", 17);
justin.name();
justin.age();
}
}
30 changes: 30 additions & 0 deletions Week3/Classes&Objects/Pokemon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
public class Pokemon {
String name;
int level;


Pokemon(){
level = 1;
}

Pokemon(String pName, int pLevel){
// Use variables defined in class (at top of page) rather than local variables (this statements)
this.name = pName;
this.level = pLevel;
}

void attack(){
System.out.println(name + "attack!");
}

public static void main(String[] args) {

Pokemon p1 = new Pokemon("Pikachu", 15);

System.out.print(p1.name + "\nLevel:" + p1.level);

Pokemon p2 = new Pokemon("Vaporeon", 69);

p2.attack();
}
}
13 changes: 13 additions & 0 deletions Week3/Classes&Objects/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Classes and Objects 🍵

### Task 🐧
- Create a class called "Me" & intialize variables name and age
- Create parameters for these variables and set them to the variables in the constructor
- Create 2 method that returns your name and age
- Create an object for this class in the main method, & use the method to print!

### Requirements 🏫
```
1. A .java file
2. Prints your name and age from the Me object
```
37 changes: 37 additions & 0 deletions Week3/Encapsulation/Information.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
public class Information {
// Private means variable cannot be accessed outside of class
private String name;
private int age;
private String gender;

Information() {
this.name = "Jimmeh";
this.age = 21;
this.gender = "Male";
}
Information(String name, int age, String gender) {
this.name = name;
this.age = age;
this.gender = gender;
}
// Public means that there is permission for other classes to use this
public String getName() {return name;}
public void setName(String newName) {this.name = newName;}
// Get Age
public int getAge() {return age;}
public void setAge(int newAge) {this.age = newAge;}
// Get gender
public String getGender() {return gender;}
public void setGender(String newGender) {this.gender = newGender;}
// Check older than 21
public boolean getOlderThan21() {
if (this.age > 21) {return true;} else {return false;}
}
public static void main(String[] args) {
Information justin = new Information("Justin", 17, "Male");
Information weston = new Information("Weston", 22, "Mouse");

System.out.println(justin.getOlderThan21());
System.out.println(weston.getOlderThan21());
}
}
14 changes: 14 additions & 0 deletions Week3/Encapsulation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Encapsulation 🍵

### Task 🐧
- Create a class callsed Information:
- Make private variables for name, age, and gender
- Create getters and setters for each of the private variables
- Create a boolean getter for if they are above the age of 21
- Create two instances of Information with different names & genders & ages either above or below 21

### Requirements 🏫
```
1. A .java file
2. Print out if people are above the age of 21 with their name and gender
```
16 changes: 16 additions & 0 deletions Week3/Inheritance/Child.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
public class Child extends Parent {
String first_name;

Child(String first_name, String lastName, String eyeColor) {
super(lastName, eyeColor);
this.first_name = first_name;
}

void getFullName() {
System.out.println("This is" + first_name + " his last name is " + last_name + ".");
}

void parentEyeColor() {
System.out.println("The parent has " + super.eye_color + " eyes.");
}
}
38 changes: 38 additions & 0 deletions Week3/Inheritance/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
public class Main {

public static void main(String[] args) {
Child Jim = new Child("Jim", "Smithson", "blue");
Jim.getLastName();
Jim.parentEyeColor();
}
}

// class Parent {
// String last_name;
// String eye_color;

// Parent(String last_name, String eyeColor) {
// this.last_name = last_name;
// this.eye_color = eyeColor;
// }
// void getLastName() {
// System.out.println("This person's last name is " + this.last_name);
// }
// }

class Child extends Parent {
String first_name;

Child(String first_name, String lastName, String eyeColor) {
super(lastName, eyeColor);
this.first_name = first_name;
}

void getFullName() {
System.out.println("This is" + first_name + " his last name is " + last_name + ".");
}

void parentEyeColor() {
System.out.println("The parent has " + super.eye_color + " eyes.");
}
}
12 changes: 12 additions & 0 deletions Week3/Inheritance/Parent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
public class Parent {
String last_name;
String eye_color;

Parent(String last_name, String eyeColor) {
this.last_name = last_name;
this.eye_color = eyeColor;
}
void getLastName() {
System.out.println("This person's last name is " + this.last_name);
}
}
21 changes: 21 additions & 0 deletions Week3/Inheritance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Inheritance 🍵

### Task 🐧
- Create a class called Parent:
- Make an instance variable called last_name
- Make an instace variable called eye color
- Create a constructor and set all the instace varaiables to the parameters passed in
- Make a public method called `getLastName()` that returns the last name

- Create a class called 'Child' that inherits (extends) Parent:
- Make an instance variable called first_name
- Make a constructor that first, sets first_name, and second, calls the constructor of Parent (Make sure to pass in the last name and eye color)
- Create a method that returns the first and last name in a String
- Create a method that returns the eye color color of the parent

### Requirements 🏫
```
1. A .java file
2. Prints the first and last name of the child
3. Prints the eye color of the parent
```
23 changes: 23 additions & 0 deletions Week3/Inheritance/Vehicle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
public class Vehicle {
double speed;

void go() {
System.out.println("This vehicle is moving!");
}

void stop() {
System.out.println("This vehicle is stopped!");
}
public static void main(String[] args) {
Car ferrari = new Car();
ferrari.go();
}
}

class Car extends Vehicle {

}

class Bicycle extends Vehicle {

}
20 changes: 20 additions & 0 deletions Week3/Polymorphism/Calculator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
public class Calculator {
public Integer division(int num1, int num2) {
return num1/num2;
}

public double division(double num1, double num2) {
return num1/num2;
}

public Integer multiply(int num1, int num2) {
return num1*num2;
}

public static void main(String[] args) {
Calculator jim = new SlowCalculator();
jim.multiply(10, 4);
jim.division(4.5, 1.5);
jim.division(4, 2);
}
}
17 changes: 17 additions & 0 deletions Week3/Polymorphism/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Polymorphism 🍵

### Task 🐧
- Create a class called 'Calculator'
- Make the a method division that divides two ints & overload it to divide two doubles
- Make the a method multiplication that multiplies two ints

- Create a class called 'SlowCalculator' that extends Calculator:
- Override the multiply method and use a loop to calculate the product of the two ints

### Requirements 🏫
```
1. A .java file
2. Prints the exact qutient of 39 and 49
3. Prints the rounded quotient of 37 and 49
4. Prints the product of 37 and 49
```
Loading