summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliamBishopCST116 <[email protected]>2022-11-28 13:09:15 -0800
committerGitHub <[email protected]>2022-11-28 13:09:15 -0800
commit593deae411421a81045336bc798966eb7d76e4d8 (patch)
tree636e07e6d4df3eee4d85a83fe82b61cf2fa12d41
parentUpdate CST116-lab3-Submit8-Bishop.cpp (diff)
downloadcst116-lab3-williambishopcst116-593deae411421a81045336bc798966eb7d76e4d8.tar.xz
cst116-lab3-williambishopcst116-593deae411421a81045336bc798966eb7d76e4d8.zip
Add files via upload
-rw-r--r--CST116-Lab3-Pseudocode- Bishop.txt77
-rw-r--r--CST116-lab3-SubmitFinal-Bishop.cpp77
2 files changed, 154 insertions, 0 deletions
diff --git a/CST116-Lab3-Pseudocode- Bishop.txt b/CST116-Lab3-Pseudocode- Bishop.txt
new file mode 100644
index 0000000..06ac5cb
--- /dev/null
+++ b/CST116-Lab3-Pseudocode- Bishop.txt
@@ -0,0 +1,77 @@
+// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
+//
+//William Bishop
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <cmath>
+#include <iomanip> Here we have the pre-compiler directives to help compute the program
+
+using namespace std;
+
+using std::cout;
+using std::cin;
+using std::endl;
+int totals(int totalpeople) Here we declare our function
+int main()
+{
+ ofstream inFile;
+ inFile.open("smaltext.txt");
+ cout << "What is the name of the file we have?"; Here we open the file of smaltext and ask for the name of a file and get the taxilogic file.
+ ofstream file_("taxilogic.txt");
+ inFile.open("taxilogic.txt");
+ if (file_.is_open()) {
+ file_ << "total fare = fare+toll \n";
+ file_ << "Cost Per Mile = fare / distance\n";
+ file_ << " Toll 1, 2, 3, 4 are: 4, 5, 7, 8. \n"; We have the total toll and the fares in the program inside of our file is open file.
+ file_ << " Fare 1, 2, 3, 4 are: 80, 15, 12, 13. \n";
+ file_ << " Total Fare 1, 2, 3, 4 are: 84, 20, 19, 21 \n";
+ file_ << "Mile rates are 15, 50, 40, 14, \n";
+ file_ << " So the Cost per miles are: 5.333,.3,.3, .928 \n "; Here we have opened the taxi logic file and kept printing in it.
+ in.close(); We close the file
+ }
+
+ double totalfare1[4] = { 84, 15, 12, 13 }; Here we have the total fare array
+ ofstream file_("totals.txt");
+ inFile.open("totals.txt");
+ if (file_.is_open()) {
+ file_ << totalfare1 << endl; Here we have the opening and printing into the totals file. We print the total fare into it.
+ in.close();
+
+ }
+ std::cin.get();
+ cout << totalfare1 << endl; Here we have the output to the screen of the total fares array
+ int totalpeople = 15;
+ int totals(int totalpeople); Here we have our function that we have and a value that we have is passed into it.
+ cout << "total fare = fare+toll , Cost Per Mile = fare / distance" << endl;
+ cout << "Toll 1, 2, 3, 4 are: 4, 5, 7, 8. Fare 1, 2, 3, 4 are: 80, 15, 12, 13. " << endl;
+ cout << "Mile rates are 15, 50, 40, 14, So the Cost per miles are: 5.333,.3,.3, .928 " << endl; Here we print out more information about the to the screen.
+
+}
+int totals(int totalpeople) Here we have our function that we have with the information passed in.
+{
+ double totalfare1[] = { 84, 15, 12, 13 }; Here we have the array again of total fares
+
+ totalpeople = 15;
+ cout << totalfare1 << endl; Here we print out the arrary of total fares
+ int totalpaid = 0;
+ for (int i = 0; i < 4; i++) {
+ totalpaid = totalpaid + totalfare1[i]; Here we loop around the array and get the total paid variable.
+ }
+ cout << totalpaid << endl;
+ float avgcostperperson;
+ avgcostperperson = totalpaid / totalpeople; Here we are printing out the variables of total cost and paid and the total fares to the screen
+ cout << avgcostperperson; Here we are printing out the rest of our information
+ ofstream file_("totals.txt");
+ inFile.open("totals.txt");
+ if (file_.is_open()) {
+ file_ << totalfare1 << endl;
+ file_ << totalpaid << endl;
+ file_ << avgcostperperson << endl;
+ file_ << totalpeople << endl; Here we opened our totals files and printed some more information into it.
+
+
+ }
+}
diff --git a/CST116-lab3-SubmitFinal-Bishop.cpp b/CST116-lab3-SubmitFinal-Bishop.cpp
new file mode 100644
index 0000000..7c3d1d5
--- /dev/null
+++ b/CST116-lab3-SubmitFinal-Bishop.cpp
@@ -0,0 +1,77 @@
+// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
+//
+//William Bishop
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <cmath>
+#include <iomanip>
+
+using namespace std;
+
+using std::cout;
+using std::cin;
+using std::endl;
+int totals(int totalpeople)
+int main()
+{
+ ofstream inFile;
+ inFile.open("smaltext.txt");
+ cout << "What is the name of the file we have?";
+ ofstream file_("taxilogic.txt");
+ inFile.open("taxilogic.txt");
+ if (file_.is_open()) {
+ file_ << "total fare = fare+toll \n";
+ file_ << "Cost Per Mile = fare / distance\n";
+ file_ << " Toll 1, 2, 3, 4 are: 4, 5, 7, 8. \n";
+ file_ << " Fare 1, 2, 3, 4 are: 80, 15, 12, 13. \n";
+ file_ << " Total Fare 1, 2, 3, 4 are: 84, 20, 19, 21 \n";
+ file_ << "Mile rates are 15, 50, 40, 14, \n";
+ file_ << " So the Cost per miles are: 5.333,.3,.3, .928 \n ";
+ in.close();
+ }
+
+ double totalfare1[4] = { 84, 15, 12, 13 };
+ ofstream file_("totals.txt");
+ inFile.open("totals.txt");
+ if (file_.is_open()) {
+ file_ << totalfare1 << endl;
+ in.close();
+
+ }
+ std::cin.get();
+ int totalpeople = 15;
+ cout << totalfare1 << endl;
+ int totals(int totalpeople);
+ cout << "total fare = fare+toll , Cost Per Mile = fare / distance" << endl;
+ cout << "Toll 1, 2, 3, 4 are: 4, 5, 7, 8. Fare 1, 2, 3, 4 are: 80, 15, 12, 13. " << endl;
+ cout << "Mile rates are 15, 50, 40, 14, So the Cost per miles are: 5.333,.3,.3, .928 " << endl;
+
+}
+int totals(int totalpeople)
+{
+ double totalfare1[] = { 84, 15, 12, 13 };
+
+ totalpeople = 15;
+ cout << totalfare1 << endl;
+ int totalpaid = 0;
+ for (int i = 0; i < 4; i++) {
+ totalpaid = totalpaid + totalfare1[i];
+ }
+ cout << totalpaid << endl;
+ float avgcostperperson;
+ avgcostperperson = totalpaid / totalpeople;
+ cout << avgcostperperson;
+ ofstream file_("totals.txt");
+ inFile.open("totals.txt");
+ if (file_.is_open()) {
+ file_ << totalfare1 << endl;
+ file_ << totalpaid << endl;
+ file_ << avgcostperperson << endl;
+ file_ << totalpeople << endl;
+
+
+ }
+}