remove sync files
This commit is contained in:
21 files changed
-638
No files matched your search
@@ -1,5 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
public class Item {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Item class for POS System.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class Item {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Item class for POS System.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class Item {
|
|
||||||
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
private
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Item class for POS System.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class Item {
|
|
||||||
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
private final double price;
|
|
||||||
|
|
||||||
private final int quantity;
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Item class for POS System.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class Item {
|
|
||||||
|
|
||||||
/** name of item. */
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
private final double price;
|
|
||||||
|
|
||||||
private final int quantity;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Item class for POS System.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class Item {
|
|
||||||
|
|
||||||
/** name of item. */
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
/** price of item. */
|
|
||||||
private final double price;
|
|
||||||
|
|
||||||
/** quanitity of item */
|
|
||||||
private final int quantity;
|
|
||||||
}
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.NumberFormat;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Item class for POS System.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class Item {
|
|
||||||
|
|
||||||
/** name of item. */
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
/** price of item. */
|
|
||||||
private final double price;
|
|
||||||
|
|
||||||
/** quanitity of item. */
|
|
||||||
private final int quantity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Item constructor.
|
|
||||||
* @param name of item
|
|
||||||
* @param price of item
|
|
||||||
* @param quantity of item
|
|
||||||
*/
|
|
||||||
public Item(String name, double price, int quantity) {
|
|
||||||
this.name = name;
|
|
||||||
this.price = price;
|
|
||||||
this.quantity = quantity;
|
|
||||||
|
|
||||||
|
|
||||||
DecimalFormat format = new DecimalFormat("#0.00");
|
|
||||||
return Double.parseDouble(format.format(a / this.students.size()));
|
|
||||||
|
|
||||||
this.price =
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Item constructor with default quantity.
|
|
||||||
* @param name of item
|
|
||||||
* @param price of item
|
|
||||||
*/
|
|
||||||
public Item(String name, double price) {
|
|
||||||
this.name = name;
|
|
||||||
this.price = price;
|
|
||||||
this.quantity = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* getName of time.
|
|
||||||
* @return name of item
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* getPrice of item.
|
|
||||||
* @return price of item
|
|
||||||
*/
|
|
||||||
public double getPrice() {
|
|
||||||
return this.price;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* getQuantity of item.
|
|
||||||
* @return quantity of item
|
|
||||||
*/
|
|
||||||
public int getQuantity() {
|
|
||||||
return this.quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* toString gives string representation of item.
|
|
||||||
* @return string of item.
|
|
||||||
*/
|
|
||||||
public String toString() {
|
|
||||||
return this.name + " $" + this.price
|
|
||||||
+ " x" + this.quantity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LockableDriver drives Lockable Coin.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class LockableDriver {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* main program entry.
|
|
||||||
* @param args unused.
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Coin coin = new Coin();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ReverseArray is self explanitory.
|
|
||||||
*/
|
|
||||||
public class ReverseArray {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ReverseArray is self explanitory.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class ReverseArray {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ReverseArray is self explanitory.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class ReverseArray {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ReverseArray is self explanitory.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class ReverseArray {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ReverseArray is self explanitory.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class ReverseArray {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* readValidInt reads and validates an integer.
|
|
||||||
* @param msg to print;
|
|
||||||
* @param scan to read input
|
|
||||||
* @return validated int
|
|
||||||
*/
|
|
||||||
private static int readValidInt(String msg, Scanner scan) {
|
|
||||||
int number = 0;
|
|
||||||
boolean valid = false;
|
|
||||||
|
|
||||||
do {
|
|
||||||
System.out.print(msg);
|
|
||||||
|
|
||||||
if (!scan.hasNextInt()) {
|
|
||||||
System.out.println(scan.next() + " is not a valid number.\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
number = scan.nextInt();
|
|
||||||
valid = true;
|
|
||||||
|
|
||||||
} while (!valid);
|
|
||||||
|
|
||||||
return number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* main program entry.
|
|
||||||
* @param args unused
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Scanner scan = new Scanner(System.in);
|
|
||||||
|
|
||||||
int length = readValidInt(
|
|
||||||
"Please enter the length for the array: ",
|
|
||||||
scan
|
|
||||||
);
|
|
||||||
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
int num = readValidInt(
|
|
||||||
"Please enter a number: ",
|
|
||||||
scan
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
import java.util.Scanner;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ReverseArray is self explanitory.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class ReverseArray {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* readValidInt reads and validates an integer.
|
|
||||||
* @param msg to print;
|
|
||||||
* @param scan to read input
|
|
||||||
* @return validated int
|
|
||||||
*/
|
|
||||||
private static int readValidInt(String msg, Scanner scan) {
|
|
||||||
int number = 0;
|
|
||||||
boolean valid = false;
|
|
||||||
|
|
||||||
do {
|
|
||||||
System.out.print(msg);
|
|
||||||
|
|
||||||
if (!scan.hasNextInt()) {
|
|
||||||
System.out.println(scan.next() + " is not a valid number.\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
number = scan.nextInt();
|
|
||||||
valid = true;
|
|
||||||
|
|
||||||
} while (!valid);
|
|
||||||
|
|
||||||
return number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* reverseIntArray reverses an array of ints.
|
|
||||||
* @param arr of ints.
|
|
||||||
* @return reversed array of ints.
|
|
||||||
*/
|
|
||||||
private static int[] reverseIntArray(int[] arr) {
|
|
||||||
int[] reversed = new int[arr.length];
|
|
||||||
|
|
||||||
int n;
|
|
||||||
for (int i = 0; i < arr.length / 2; i++) {
|
|
||||||
n = arr[arr.length - i];
|
|
||||||
arr[arr.length - i] = arr[i];
|
|
||||||
arr[i] = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
return reversed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* main program entry.
|
|
||||||
* @param args unused
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Scanner scan = new Scanner(System.in);
|
|
||||||
|
|
||||||
int length = readValidInt(
|
|
||||||
"Please enter the length for the array: ",
|
|
||||||
scan
|
|
||||||
);
|
|
||||||
|
|
||||||
int[] arr = new int[length];
|
|
||||||
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
int num = readValidInt(
|
|
||||||
"Please enter a number: ",
|
|
||||||
scan
|
|
||||||
);
|
|
||||||
arr[i] = num;
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println(Arrays.toString(arr));
|
|
||||||
|
|
||||||
arr = reverseIntArray(arr);
|
|
||||||
|
|
||||||
System.out.println(Arrays.toString(arr));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
public class Shopping {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shopping cart driver.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class Shopping {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shopping cart driver.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class Shopping {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* main program entry.
|
|
||||||
* @param args unused.
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
final int burgerPrice = 3.16;
|
|
||||||
Item burger = new Item("Burger", 8.16, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transaction of items.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class Transaction {
|
|
||||||
|
|
||||||
/** items in transaction. */
|
|
||||||
private Item[] items;
|
|
||||||
|
|
||||||
/** totalPrice of transaction. */
|
|
||||||
private double totalPrice;
|
|
||||||
|
|
||||||
/** itemCount of transaction. */
|
|
||||||
private int itemCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tramsaction constructor.
|
|
||||||
* @param size of items;
|
|
||||||
*/
|
|
||||||
public Transaction(int size) {
|
|
||||||
this.items = new Item[size];
|
|
||||||
this.totalPrice = 0;
|
|
||||||
this.itemCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addToCart(String name, double price, int quantity) {
|
|
||||||
Item item = new Item(name, price, quantity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transaction of items.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class Transaction {
|
|
||||||
|
|
||||||
/** items in transaction. */
|
|
||||||
private Item[] items;
|
|
||||||
|
|
||||||
/** totalPrice of transaction. */
|
|
||||||
private double totalPrice;
|
|
||||||
|
|
||||||
/** itemCount of transaction. */
|
|
||||||
private int itemCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tramsaction constructor.
|
|
||||||
* @param size of items;
|
|
||||||
*/
|
|
||||||
public Transaction(int size) {
|
|
||||||
this.items = new Item[size];
|
|
||||||
this.totalPrice = 0;
|
|
||||||
this.itemCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* addToCart creates an item to add to cart.
|
|
||||||
* @param name of item
|
|
||||||
* @param price of item
|
|
||||||
* @param quantity of item
|
|
||||||
*/
|
|
||||||
public void addToCart(String name, double price, int quantity) {
|
|
||||||
Item item = new Item(name, price, quantity);
|
|
||||||
|
|
||||||
if (this.itemCount == this.items.length) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
this.items[itemCount] = item;
|
|
||||||
this.itemCount++;
|
|
||||||
|
|
||||||
this.totalPrice += price * quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* addToCart adds existing item to cart.
|
|
||||||
* @param item to add
|
|
||||||
*/
|
|
||||||
public void addToCart(Item item) {
|
|
||||||
this.items[itemCount] = item;
|
|
||||||
this.itemCount++;
|
|
||||||
|
|
||||||
this.totalPrice += item.getPrice() * item.getQuantity();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** increaseSize of cart. */
|
|
||||||
public void increaseSize() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transaction of items.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class Transaction {
|
|
||||||
|
|
||||||
/** items in transaction. */
|
|
||||||
private Item[] items;
|
|
||||||
|
|
||||||
/** totalPrice of transaction. */
|
|
||||||
private double totalPrice;
|
|
||||||
|
|
||||||
/** itemCount of transaction. */
|
|
||||||
private int itemCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tramsaction constructor.
|
|
||||||
* @param size of items;
|
|
||||||
*/
|
|
||||||
public Transaction(int size) {
|
|
||||||
this.items = new Item[size];
|
|
||||||
this.totalPrice = 0;
|
|
||||||
this.itemCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* addToCart creates an item to add to cart.
|
|
||||||
* @param name of item
|
|
||||||
* @param price of item
|
|
||||||
* @param quantity of item
|
|
||||||
*/
|
|
||||||
public void addToCart(String name, double price, int quantity) {
|
|
||||||
Item item = new Item(name, price, quantity);
|
|
||||||
|
|
||||||
if (this.itemCount == this.items.length) {
|
|
||||||
increaseSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.items[itemCount] = item;
|
|
||||||
this.itemCount++;
|
|
||||||
|
|
||||||
this.totalPrice += price * quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* addToCart adds existing item to cart.
|
|
||||||
* @param item to add
|
|
||||||
*/
|
|
||||||
public void addToCart(Item item) {
|
|
||||||
if (this.itemCount == this.items.length) {
|
|
||||||
increaseSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.items[itemCount] = item;
|
|
||||||
this.itemCount++;
|
|
||||||
|
|
||||||
this.totalPrice += item.getPrice() * item.getQuantity();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** increaseSize of cart. */
|
|
||||||
public void increaseSize() {
|
|
||||||
final int up = 3;
|
|
||||||
Item[] updatedItems = new Item[this.items.length + up];
|
|
||||||
|
|
||||||
for (int i = 0; i < this.itemCount; i++) {
|
|
||||||
updatedItems[i] = this.items[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
package ca.bcit.comp1510.lab11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transaction of items.
|
|
||||||
* @author Braeden Sowinski
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public class Transaction {
|
|
||||||
|
|
||||||
/** items in transaction. */
|
|
||||||
private Item[] items;
|
|
||||||
|
|
||||||
/** totalPrice of transaction. */
|
|
||||||
private double totalPrice;
|
|
||||||
|
|
||||||
/** itemCount of transaction. */
|
|
||||||
private int itemCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tramsaction constructor.
|
|
||||||
* @param size of items;
|
|
||||||
*/
|
|
||||||
public Transaction(int size) {
|
|
||||||
this.items = new Item[size];
|
|
||||||
this.totalPrice = 0;
|
|
||||||
this.itemCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* addToCart creates an item to add to cart.
|
|
||||||
* @param name of item
|
|
||||||
* @param price of item
|
|
||||||
* @param quantity of item
|
|
||||||
*/
|
|
||||||
public void addToCart(String name, double price, int quantity) {
|
|
||||||
Item item = new Item(name, price, quantity);
|
|
||||||
|
|
||||||
if (this.itemCount == this.items.length) {
|
|
||||||
increaseSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.items[itemCount] = item;
|
|
||||||
this.itemCount++;
|
|
||||||
|
|
||||||
this.totalPrice += price * quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* addToCart adds existing item to cart.
|
|
||||||
* @param item to add
|
|
||||||
*/
|
|
||||||
public void addToCart(Item item) {
|
|
||||||
if (this.itemCount == this.items.length) {
|
|
||||||
increaseSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.items[itemCount] = item;
|
|
||||||
this.itemCount++;
|
|
||||||
|
|
||||||
this.totalPrice += item.getPrice() * item.getQuantity();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** increaseSize of cart. */
|
|
||||||
public void increaseSize() {
|
|
||||||
final int up = 3;
|
|
||||||
Item[] updatedItems = new Item[this.items.length + up];
|
|
||||||
|
|
||||||
for (int i = 0; i < this.itemCount; i++) {
|
|
||||||
updatedItems[i] = this.items[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
this.items = updatedItems;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user