Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
thesleuth authored Apr 26, 2024
0 parents commit 7c7e011
Show file tree
Hide file tree
Showing 23 changed files with 1,012 additions and 0 deletions.
158 changes: 158 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
*.iml
.idea/**
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

.project
.classpath
.settings


#maven build target
target/

.DS_Store
.idea
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Quiz 9-5

## Overview
* This quiz will measure your understanding of Object Orientation:
1. object orientation - (complete the following)
* `Account`
* `BankAccount`
* `Bank`
* `Transactable`
* `Employee`
* `Worker`



<hr>
<hr>

## Object Orientation
### Account
* **Description**
* The purpose of this class is to create a model of an `Account`.
* **Methods to Complete**
* `Long getId()`
* `void setId(Long id)`



### BankAccount
* **Description**
* The purpose of this class is to create a subclass of an `Account` which implements `Transactable`.
* **Methods to Complete**
* `void setBalance(Double double)`



### Bank
* **Description**
* The purpose of this class is to create an encapsulation of a `Collection` of `BankAccount` objects.
* **Methods to Complete**
* `BankAccount removeBankAccountByIndex(Integer indexNumber)`
* `void addBankAccount(BankAccount bankAccount)`
* `Boolean containsBankAccount(BankAccount bankAccount)`



### Employee
* **Description**
* The purpose of this class is to create an implementation of a `Worker` and `Transactable` which can `deposit`, `withdrawal`, and `getBalance`, of its composite `BankAccount`.
* **Methods to Complete**
* `BankAccount getBankAccount()`
* `void setBankAccount(BankAccount bankAccount)`

### Transactable
* **Description**
* The purpose of this interface is to ensure a class can `deposit`, `withdrawal`, and `getBalance`.
* **Methods to Complete**
* `void deposit(Double amountToIncreaseBy)`
* `void withdrawal(Double amountToDecreaseBy)`
* `Double getBalance()`

### Worker
* **Description**
* The purpose of this interface is to ensure a class has `BankAccount`
* **Methods to Complete**
* `BankAccount getBankAccount()`
* `void setBankAccount(BankAccount bankAccount)`











32 changes: 32 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>rocks.zipcode</groupId>
<artifactId>quiz4</artifactId>
<version>1.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>


</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package rocks.zipcode.quiz4.objectorientation.account;

/**
* @author leon on 30/12/2018.
*/
public class Account extends BankAccount {
public Long getId() {
return null;
}

public void setId(Long id) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package rocks.zipcode.quiz4.objectorientation.account;

/**
* @author leon on 27/12/2018.
*/
public class Bank {
public BankAccount removeBankAccountByIndex(Integer indexNumber) {
return null;
}

public void addBankAccount(BankAccount bankAccount) {
}

public Boolean containsBankAccount(BankAccount bankAccount) {
throw new UnsupportedOperationException("Method not yet implemented");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package rocks.zipcode.quiz4.objectorientation.account;

/**
* @author leon on 27/12/2018.
*/
public class BankAccount {
public void setBalance(Double val) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package rocks.zipcode.quiz4.objectorientation.account;

/**
* @author leon on 30/12/2018.
*/
public class Employee {
public Employee() {
}

public Employee(BankAccount bankAccount) {
}

public BankAccount getBankAccount() {
return null;
}

public void setBankAccount(BankAccount bankAccount) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package rocks.zipcode.quiz4.objectorientation.account;

/**
* @author leon on 30/12/2018.
*/
public interface Transactable {
void deposit(Double amountToIncreaseBy);
void withdrawal(Double amountToDecreaseBy);
Double getBalance();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package rocks.zipcode.quiz4.objectorientation.account;

/**
* @author leon on 30/12/2018.
*/
public interface Worker {
void increaseHoursWorked(Double numberOfHours);
Double getHoursWorked();
Double getHourlyWage();
Double getMoneyEarned();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package rocks.zipcode.quiz4.objectorientation.account;

import org.junit.Assert;
import org.junit.Test;

/**
* @author leon on 30/12/2018.
*/
public class AccountPolymorphismTest {
private Object account = new Account();
@Test
public void test1() {
Assert.assertFalse(account instanceof Transactable);
}

@Test
public void test2() {
Assert.assertFalse(account instanceof BankAccount);
}
}
Loading

0 comments on commit 7c7e011

Please sign in to comment.