Skip to content

Reusing #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
Binary file added BankAccountUML.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Product Inventory Project UML.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?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>battin.preston</groupId>
<artifactId>AccessControl</artifactId>
<version>1.0-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>

</dependencies>


<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>


</project>
30 changes: 30 additions & 0 deletions src/main/java/Account.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Created by prestonbattin on 1/18/17.
*/
public abstract class Account {

protected String accountName;
protected double balance;


Account(String accountName, double balance){

this.accountName = accountName;
this.balance = balance;
}

protected abstract void creditAccount(double amount);
protected abstract void debitAccount(double amount);

protected String getAccountName(){

return this.accountName;
}

protected double getBalance(){

return this.balance;
}


}
52 changes: 52 additions & 0 deletions src/main/java/BusinessAccount.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* Created by prestonbattin on 1/19/17.
*/
public class BusinessAccount extends Account{

static private int accountCount = 1;
private int businessAccountNumber;
private double interest = 2.5;

BusinessAccount(String name, double balance){

super(name, balance);

this.businessAccountNumber = accountCount;
accountCount++;

this.interest = interest;
}

@Override
protected void creditAccount(double amount) {
this.balance += amount;
}

@Override
protected void debitAccount(double amount) {

this.balance -= amount;
}

@Override
public double getBalance(){

return super.getBalance();
}

public int getBusinessAccountNumber(){

return this.businessAccountNumber;
}

@Override
public String getAccountName(){

return super.getAccountName();
}

public double getInterest(){

return this.interest;
}
}
47 changes: 47 additions & 0 deletions src/main/java/CheckingAccount.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Created by prestonbattin on 1/19/17.
*/
public class CheckingAccount extends Account {

static private int accountCount = 1;
private int checkingAccountNumber;


CheckingAccount(String accountName, double balance){
super(accountName,balance);

this.checkingAccountNumber = accountCount;
accountCount++;
}

@Override
protected void creditAccount(double amount) {

this.balance += amount;
}

@Override
protected void debitAccount(double amount) {

this.balance -= amount;
}

@Override
public double getBalance(){

return super.getBalance();
}

public int getCheckingAccountNumber(){

return this.checkingAccountNumber;
}

@Override
public String getAccountName(){

return super.getAccountName();
}


}
44 changes: 44 additions & 0 deletions src/main/java/Human.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Created by prestonbattin on 1/18/17.
*/
public class Human {

protected String name, gender, occupation, address;
protected int age;


Human(String name, String gender, String occupation, String address, int age){

this.name = name;
this.gender = gender;
this.occupation = occupation;
this.address = address;
this.age = age;
}

protected void getName(){

System.out.println("Your name is " + name);
}

protected void getGender(){

System.out.println("You are " + gender);
}

protected void getOccupation(){

System.out.println("Your occupation is " + occupation);
}

protected void getAddress(){

System.out.println("Your address is " + address);
}

protected void getAge(){

System.out.println("Your age is " + age);
}
}

31 changes: 31 additions & 0 deletions src/main/java/Inventory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Created by prestonbattin on 1/18/17.
*/
public class Inventory {

int quantity;
double totalCost, price;


Inventory(int quantity, double price){

this.quantity = quantity;
this.price = price;
}

public double getTotalPrice(){

return quantity * price;
}

public int getQuantity(){

return this.quantity;
}

public double getPrice(){

return this.price;
}

}
57 changes: 57 additions & 0 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
* Created by prestonbattin on 1/18/17.
*/
public class Main {

public static void main(String[] args) {

//Rotate Array

List number = new ArrayList();

for (int i = 1; i < 7; i++) {
number.add(i);
}
System.out.println("Before rotations " + Arrays.toString(number.toArray()));
RotateArray rotate = new RotateArray();
System.out.println("after rotation");
rotate.swapList(number, 5);


//Human Class

Human person = new Human("Kent Klark", "Male", "Bus Boy", "101 Wazoo Lane", 23);
SuperHero superHero = new SuperHero("Kevin", "Female", "Cheer Leader", "454 Hello World Lane", 20, "Good",
"Kelly Frost", "Laser Vision");

person.getName();
person.getGender();
person.getOccupation();
person.getAddress();
person.getAge();

superHero.getName();
superHero.getGender();
superHero.getOccupation();
superHero.getAddress();
superHero.getAge();
superHero.getSide();
superHero.getHeroName();
superHero.getAbility();

//Class Manager








}
}

40 changes: 40 additions & 0 deletions src/main/java/Product.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Created by prestonbattin on 1/18/17.
*/
public class Product {
protected Inventory tracker;
protected double price;
protected int id, quantity;

Product(int id, int quantity, double price){

this.price = price;
this.id = id;
this.quantity = quantity;

tracker = new Inventory(quantity, price){};
}


public int getId(){

return this.id;
}

public double getPrice(){

return tracker.getPrice();
}

public int getQuantity(){

return tracker.quantity;
}

public double getTotalCost(){

return tracker.getTotalPrice();
}


}
22 changes: 22 additions & 0 deletions src/main/java/RotateArray.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

import java.util.*;



/**
* Created by prestonbattin on 1/18/17.
*/
public class RotateArray {



public void swapList(List array, int rotate){



Collections.rotate(array, rotate);

System.out.println(Arrays.toString(array.toArray()));

}
}
Loading