generated from ZipCodeCore/Maven.Quiz9-5
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7c7e011
Showing
23 changed files
with
1,012 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)` | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
13 changes: 13 additions & 0 deletions
13
src/main/java/rocks/zipcode/quiz4/objectorientation/account/Account.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/rocks/zipcode/quiz4/objectorientation/account/Bank.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/rocks/zipcode/quiz4/objectorientation/account/BankAccount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/rocks/zipcode/quiz4/objectorientation/account/Employee.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | ||
|
||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/rocks/zipcode/quiz4/objectorientation/account/Transactable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/rocks/zipcode/quiz4/objectorientation/account/Worker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
20 changes: 20 additions & 0 deletions
20
src/test/java/rocks/zipcode/quiz4/objectorientation/account/AccountPolymorphismTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
Oops, something went wrong.