summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2022-09-09 15:19:13 -0600
committerGitHub <noreply@github.com>2022-09-09 15:19:13 -0600
commit6ae81ee58a1d2ffa8f8f5fe9dc45a8f064c31c4d (patch)
tree29637ebf9203bce4029b9405feec8d303d9610c1
parent21aaa09ec4ada850c7ff11f61e31a3c64ac3ddf6 (diff)
added code
-rw-r--r--hw2/almondMilk.cpp23
-rw-r--r--hw2/calcSigmoid.cpp19
-rw-r--r--hw2/convertCurrency.cpp20
-rw-r--r--hw2/helloWorld.cpp1
-rw-r--r--hw2/helloYou.cpp16
-rw-r--r--hw2/snowfall.cpp20
6 files changed, 99 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
diff --git a/hw2/calcSigmoid.cpp b/hw2/calcSigmoid.cpp
new file mode 100644
index 0000000..723ec66
--- /dev/null
+++ b/hw2/calcSigmoid.cpp
@@ -0,0 +1,19 @@
+// CSCI 1300 Fall 2022
+// Author: Navan Chauhan
+// Recitation: 307 – TA name
+// Homework 2 - Problem 6
+
+#include<iostream>
+#include<cmath>
+
+using namespace std;
+
+int main() {
+ double x = 0;
+ double sigmoid = 0;
+ cout << "Enter a value for x:\n";
+ cin >> x;
+ sigmoid = 1/(1+(exp(-x)));
+ cout << "The sigmoid for x=" << x << " is " << sigmoid;
+ return 0;
+} \ No newline at end of file
diff --git a/hw2/convertCurrency.cpp b/hw2/convertCurrency.cpp
new file mode 100644
index 0000000..1d19136
--- /dev/null
+++ b/hw2/convertCurrency.cpp
@@ -0,0 +1,20 @@
+// CSCI 1300 Fall 2022
+// Author: Navan Chauhan
+// Recitation: 307 – TA name
+// Homework 2 - Problem 5
+
+#include<iostream>
+
+using namespace std;
+
+int main() {
+ int gems = 0, gold = 0, bolts = 0;
+ cout << "Enter the number of Bolts:\n";
+ cin >> bolts;
+ gold = bolts/23;
+ bolts = bolts % 23;
+ gems = gold / 13;
+ gold = gold % 13;
+ cout << gems << " Gem(s) " << gold << " GoldCoin(s) " << bolts << " Bolt(s)";
+ return 0;
+} \ No newline at end of file
diff --git a/hw2/helloWorld.cpp b/hw2/helloWorld.cpp
index f632bdb..f4b5587 100644
--- a/hw2/helloWorld.cpp
+++ b/hw2/helloWorld.cpp
@@ -1,5 +1,6 @@
// CSCI 1300 Fall 2022
// Author: Navan Chauhan
+// Recitation: 307 – TA name
// Homework 2 - Problem 1
#include<iostream>
diff --git a/hw2/helloYou.cpp b/hw2/helloYou.cpp
new file mode 100644
index 0000000..98f06ce
--- /dev/null
+++ b/hw2/helloYou.cpp
@@ -0,0 +1,16 @@
+// CSCI 1300 Fall 2022
+// Author: Navan Chauhan
+// Recitation: 307 – TA name
+// Homework 2 - Problem 2
+
+#include<iostream>
+
+using namespace std;
+
+int main() {
+ string name;
+ cout << "Please enter your name below:\n";
+ cin >> name;
+ cout << "Hello, " << name << "!";
+ return 0;
+} \ No newline at end of file
diff --git a/hw2/snowfall.cpp b/hw2/snowfall.cpp
new file mode 100644
index 0000000..2d54a90
--- /dev/null
+++ b/hw2/snowfall.cpp
@@ -0,0 +1,20 @@
+// CSCI 1300 Fall 2022
+// Author: Navan Chauhan
+// Recitation: 307 – TA name
+// Homework 2 - Problem 4
+
+#include<iostream>
+
+using namespace std;
+
+int main() {
+ int num_days, breck, vail, copper;
+
+ cout << "How many days in the future would you like a prediction for?\n";
+ cin >> num_days;
+ breck = 25+(10*num_days)-(5*num_days);
+ vail = 28+(14*num_days)-(2*num_days);
+ copper = 40+(5*num_days)-(3*num_days);
+ cout << "Breckenridge will have " << breck << " inches, Vail will have " << vail << " inches, and Copper Mountain will have " << copper << " inches.";
+ return 0;
+}