remove sync and tmp files
This commit is contained in:
19 files changed
-700
No files matched your search
@@ -1,78 +0,0 @@
|
||||
package ca.bcit.comp1510.lab11;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* 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.quantity = quantity;
|
||||
DecimalFormat format = new DecimalFormat("#0.00");
|
||||
this.price = Double.parseDouble(format.format(price));
|
||||
}
|
||||
|
||||
/**
|
||||
* Item constructor with default quantity.
|
||||
* @param name of item
|
||||
* @param price of item
|
||||
*/
|
||||
public Item(String name, double price) {
|
||||
this.name = name;
|
||||
DecimalFormat format = new DecimalFormat("#0.00");
|
||||
this.price = Double.parseDouble(format.format(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;
|
||||
}
|
||||
}
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
package ca.bcit.comp1510.lab11;
|
||||
|
||||
public class Item {
|
||||
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
package ca.bcit.comp1510.lab11;
|
||||
|
||||
/**
|
||||
* Item class for POS System.
|
||||
* @author Braeden Sowinski
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class Item {
|
||||
|
||||
}
|
||||
-13
@@ -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
|
||||
}
|
||||
-15
@@ -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;
|
||||
}
|
||||
-16
@@ -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;
|
||||
}
|
||||
-18
@@ -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;
|
||||
}
|
||||
-83
@@ -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;
|
||||
}
|
||||
}
|
||||
-19
@@ -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,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 - 1 - i];
|
||||
arr[arr.length - 1 - 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));
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package ca.bcit.comp1510.lab11;
|
||||
|
||||
/**
|
||||
* ReverseArray is self explanitory.
|
||||
*/
|
||||
public class ReverseArray {
|
||||
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
package ca.bcit.comp1510.lab11;
|
||||
|
||||
/**
|
||||
* ReverseArray is self explanitory.
|
||||
* @author Braeden Sowinski
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class ReverseArray {
|
||||
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
package ca.bcit.comp1510.lab11;
|
||||
|
||||
/**
|
||||
* ReverseArray is self explanitory.
|
||||
* @author Braeden Sowinski
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class ReverseArray {
|
||||
|
||||
|
||||
}
|
||||
-58
@@ -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
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
-85
@@ -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));
|
||||
}
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
package ca.bcit.comp1510.lab11;
|
||||
|
||||
/**
|
||||
* Shopping cart driver.
|
||||
* @author Braeden Sowinski
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class Shopping {
|
||||
|
||||
}
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
-32
@@ -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);
|
||||
}
|
||||
}
|
||||
-72
@@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user