summaryrefslogtreecommitdiff
path: root/hw2/almondMilk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'hw2/almondMilk.cpp')
-rw-r--r--hw2/almondMilk.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/hw2/almondMilk.cpp b/hw2/almondMilk.cpp
new file mode 100644
index 0000000..77bc61e
--- /dev/null
+++ b/hw2/almondMilk.cpp
@@ -0,0 +1,23 @@
+// CSCI 1300 Fall 2022
+// Author: Navan Chauhan
+// Recitation: 307 – TA name
+// Homework 2 - Problem 3
+
+#include<iostream>
+#include<iomanip>
+
+using namespace std;
+
+int main() {
+ double side_len = 0;
+ double height = 0;
+ double volume = 0;
+
+ cout << "What is the side length of the base of the carton in inches?\n";
+ cin >> side_len;
+ cout << "What is the height of the carton in inches?\n";
+ cin >> height;
+ volume = (side_len*side_len)*height*0.55;
+ cout << "The carton has a volume of " << fixed << setprecision(1) << volume<<" ounces.";
+ return 0;
+} \ No newline at end of file