diff --git a/TwoLiterStack/.classpath b/TwoLiterStack/.classpath
new file mode 100644
index 0000000..d171cd4
--- /dev/null
+++ b/TwoLiterStack/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/TwoLiterStack/src/main/Main.java b/TwoLiterStack/src/main/Main.java
index b5e47e3..fbfad72 100644
--- a/TwoLiterStack/src/main/Main.java
+++ b/TwoLiterStack/src/main/Main.java
@@ -1,13 +1,21 @@
/*
* Bill Nicholson
* nicholdw@ucmail.uc.edu
+ *
+ * Name Alicia J Davoyan
+ * Email: davoyaaj@mail.uc.edu
+ * Assignment #: Assignment 10
+ * Course/Term: IT2045C Spring 2022
+ * Description: This is our 10th assignment and we use our debugging skillz to fix the program and figure out why there is no Dr. Pepper and fix it.
+ * Anything else:
*/
+
package main;
import java.text.DecimalFormat;
import java.util.Stack;
-public class Main {
+public class Main {
public static void main(String[] args) {
// ToDo Declare and instantiate a TwoLiterStack object
@@ -17,7 +25,7 @@ public static void main(String[] args) {
TwoLiter.add(twoLiterStack, 100000);
// ToDo print the number of items in the TwoLiterStack object
- System.out.println("The stack has " + twoLiterStack.size() + " items in it.");
+ System.out.println("The stack has " + twoLiterStack.size() + " items in it.");
// ToDo Iterate over the stack and compute the total price of all the items. An enhanced for loop is good here.
double totalPrice = 0;
@@ -25,7 +33,6 @@ public static void main(String[] args) {
totalPrice += twoLiter.getPrice();
}
-
// ToDo Print the total price to exactly two decimal places.
// ToDo in the comments here, explain why this number changes each time you run the program.
DecimalFormat df2 = new DecimalFormat("#.##");
diff --git a/TwoLiterStack/src/main/TwoLiter.java b/TwoLiterStack/src/main/TwoLiter.java
index 9a6d0d0..2ee00ae 100644
--- a/TwoLiterStack/src/main/TwoLiter.java
+++ b/TwoLiterStack/src/main/TwoLiter.java
@@ -1,7 +1,15 @@
/*
* Bill Nicholson
* nicholdw@ucmail.uc.edu
+ *
+ * Name Alicia J Davoyan
+ * Email: davoyaaj@mail.uc.edu
+ * Assignment #: Assignment 10
+ * Course/Term: IT2045C Spring 2022
+ * Description: This is our 10th assignment and we use our debugging skillz to fix the program and figure out why there is no Dr. Pepper and fix it.
+ * Anything else:
*/
+
package main;
import java.util.Random;
@@ -17,7 +25,8 @@ public class TwoLiter {
private static String[] UPCs = {"049000050103", "00049000050110", "00049000050141", "xxxxxxxxxxxxxx", " 00049000050165", "00049000006131", "00078000082463"};
private String UPC;
private String flavor;
- private double price;
+ private double price;
+
/**
* Constructor
* @param UPC The Universal Product Code that uniquely identifies this type of product
@@ -47,8 +56,8 @@ public static void add(Stack twoLiterStack, int count ) {
// Random r = new Random(42);
Random r = new Random();
for (int i = 0; i < count; i++) {
- twoLiterStack.add(new TwoLiter(UPCs[r.nextInt(UPCs.length - 1)],
- flavors[r.nextInt(flavors.length - 1)],
+ twoLiterStack.add(new TwoLiter(UPCs[r.nextInt(UPCs.length )],
+ flavors[r.nextInt(flavors.length )],
1.00 + r.nextFloat()));
}
}