summaryrefslogtreecommitdiff
path: root/BlankConsoleLab
diff options
context:
space:
mode:
Diffstat (limited to 'BlankConsoleLab')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp16
-rw-r--r--BlankConsoleLab/BlankConsoleLab.vcxproj11
-rw-r--r--BlankConsoleLab/BlankConsoleLab.vcxproj.filters2
-rw-r--r--BlankConsoleLab/CST116_Lab3_BlankConsoleLab_Crawford.cpp145
-rw-r--r--BlankConsoleLab/Large1.txt48
-rw-r--r--BlankConsoleLab/Small1.txt11
6 files changed, 211 insertions, 22 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
deleted file mode 100644
index ed5f807..0000000
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
-//
-
-#include <iostream>
-
-using namespace std;
-
-using std::cout;
-using std::cin;
-using std::endl;
-
-int main()
-{
- cout << "Hello World!\n";
-}
-
diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj b/BlankConsoleLab/BlankConsoleLab.vcxproj
index db2e734..6d20af4 100644
--- a/BlankConsoleLab/BlankConsoleLab.vcxproj
+++ b/BlankConsoleLab/BlankConsoleLab.vcxproj
@@ -24,31 +24,32 @@
<ProjectGuid>{3cecade6-3e15-4852-bd24-65bfe5d3a3aa}</ProjectGuid>
<RootNamespace>BlankConsoleLab</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+ <ProjectName>CST16_Lab3_Crawford</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
+ <PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
+ <PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
+ <PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
+ <PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@@ -139,7 +140,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="BlankConsoleLab.cpp" />
+ <ClCompile Include="CST116_Lab3_BlankConsoleLab_Crawford.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters
index aca1dd9..fa2a605 100644
--- a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters
+++ b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters
@@ -15,7 +15,7 @@
</Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="BlankConsoleLab.cpp">
+ <ClCompile Include="CST116_Lab3_BlankConsoleLab_Crawford.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
diff --git a/BlankConsoleLab/CST116_Lab3_BlankConsoleLab_Crawford.cpp b/BlankConsoleLab/CST116_Lab3_BlankConsoleLab_Crawford.cpp
new file mode 100644
index 0000000..9c358dd
--- /dev/null
+++ b/BlankConsoleLab/CST116_Lab3_BlankConsoleLab_Crawford.cpp
@@ -0,0 +1,145 @@
+// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
+//CST 116_Lab 3_Crawford
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <iomanip>
+// note for me. Remember Palindrome issues in coding!!
+
+using namespace std;
+
+int Pick_up[50];
+int Drop_off[50];
+int Passenger_count[50];
+
+float Distance_travelled[50];
+float Fare_amount[50];
+float Toll_amount[50];
+float CPM[50];
+
+double Total_fare[50];
+
+int numEntries;
+
+int ReadData(ifstream& file)
+{
+ int t = -1;
+
+ while (!file.eof())
+ {
+ t++;
+
+ file >> Pick_up[t] >> Drop_off[t] >> Passenger_count[t] >> Distance_travelled[t] >> Fare_amount[t] >> Toll_amount[t];
+
+ Total_fare[t] = Fare_amount[t] + Toll_amount[t];
+
+ if (Distance_travelled[t] != 0)
+ {
+ CPM[t] = Fare_amount[t] / Distance_travelled[t];
+ }
+ else CPM[t] = 0;
+ }
+
+ t++;
+
+ return t;
+}
+
+
+void GenerateTotals(int numEntries)
+{
+ int Total_Passengers = 0;
+ double Total_Paid = 0;
+
+ for (int i = 0; i <= numEntries; i++)
+ {
+ Total_Passengers += Passenger_count[i];
+ Total_Paid += Total_fare[i];
+
+ }
+ cout << "Total Passengers: " << Total_Passengers << endl;
+ cout << "Total Paid: $" << Total_Paid << endl;
+ cout << "AVG Cost per Person: $" << Total_Paid / Total_Passengers << endl;
+ cout << "Total Trips: " << numEntries << endl;
+
+}
+
+int main()
+{
+ ifstream inFile;
+ string fileName;
+
+ cout << fixed << setprecision(2);
+ char choice = 'Y';
+
+ while (choice == 'Y')
+ {
+ while (!inFile.is_open())
+ {
+ cout << "Please enter data file name with the .txt extention" << endl;
+ cin >> fileName;
+
+ inFile.open(fileName);
+
+ if (inFile.is_open()) {
+ cout << "\nAccess Granted: " << fileName << endl;
+ }
+ else
+ {
+ cout << "\nError 404 Acess Denied....ahh ahh ahh you didn't say the magic word! ahh ahh ahh!" << fileName << endl;
+ }
+
+
+ cout << endl;
+ }
+
+
+ int numEntries = ReadData(inFile);
+
+ GenerateTotals(numEntries);
+
+
+ choice = 'A';
+
+ while (choice != 'Y' && choice != 'N')
+ {
+ cout << "\nWould you like a diplay table of the data? Y/N" << endl;
+ cin >> choice;
+ }
+
+
+ if (choice == 'Y')
+ {
+ cout << left << setw(10) << "\nEntry" << setw(10) << "Pickup"
+ << setw(10) << "Dropoff" << setw(10) << "#PASS"
+ << setw(10) << "DIST" << setw(10) << "Fares"
+ << setw(10) << "Tolls" << setw(10) << "Total$"
+ << setw(10) << "$/Mile" << endl;
+
+ for (int i = 0; i < numEntries; i++)
+ {
+ cout << left << setw(10) << i + 1 << Pick_up[i]
+ << setw(10) << Drop_off[i] << setw(10) << Passenger_count[i]
+ << setw(10) << Distance_travelled[i] << setw(10) << Fare_amount[i]
+ << setw(10) << Toll_amount[i] << setw(10) << Total_fare[i]
+ << setw(10) << CPM[i] << endl;
+
+ }
+ }
+ choice = 'A';
+
+ while (choice != 'Y' && choice != 'N')
+ {
+ cout << "\nWould you like to open another file? Y/N" << endl;
+ cin >> choice;
+ }
+
+
+ inFile.close();
+ cout << endl;
+ }
+
+
+}
+
diff --git a/BlankConsoleLab/Large1.txt b/BlankConsoleLab/Large1.txt
new file mode 100644
index 0000000..d9fa1b1
--- /dev/null
+++ b/BlankConsoleLab/Large1.txt
@@ -0,0 +1,48 @@
+129 7 3 1.3 7.5 0
+36 69 1 11.41 32 5.76
+7 41 1 4.6 15 5.76
+150 61 2 6.75 23 0
+112 17 1 3.84 15 0
+80 112 6 1.64 9.5 0
+256 183 1 16.08 44.5 0
+138 166 2 7.4 24.5 6.12
+142 50 5 1.7 8 0
+107 163 0 3.6 17 0
+132 3 2 19.1 52 6.12
+48 41 1 4.07 18 4.36
+132 226 1 14.3 39 0
+229 151 1 3.96 14.5 4.58
+238 166 1 0.76 4.5 0
+151 238 2 0.64 5 2.2
+138 82 4 3 12 0
+264 231 3 10.74 32.5 0
+170 114 5 2.01 9 0
+186 87 2 3.45 12 0
+209 256 1 3.79 17 0
+132 107 1 17.2 52 6.12
+232 112 1 3.1 11 0
+164 141 3 2.85 10.5 0
+129 7 3 1.3 7.5 0
+36 69 1 11.41 32 5.76
+7 41 1 4.6 15 5.76
+150 61 2 6.75 23 0
+112 17 1 3.84 15 0
+80 112 6 1.64 9.5 0
+256 183 1 16.08 44.5 0
+138 166 2 7.4 24.5 6.12
+142 50 5 1.7 8 0
+107 163 0 3.6 17 0
+132 3 2 19.1 52 6.12
+48 41 1 4.07 18 4.36
+132 226 1 14.3 39 0
+229 151 1 3.96 14.5 4.58
+238 166 1 0.76 4.5 0
+151 238 2 0.64 5 2.2
+138 82 4 3 12 0
+264 231 3 10.74 32.5 0
+170 114 5 2.01 9 0
+186 87 2 3.45 12 0
+209 256 1 3.79 17 0
+132 107 1 17.2 52 6.12
+232 112 1 3.1 11 0
+164 141 3 2.85 10.5 0 \ No newline at end of file
diff --git a/BlankConsoleLab/Small1.txt b/BlankConsoleLab/Small1.txt
new file mode 100644
index 0000000..3d94536
--- /dev/null
+++ b/BlankConsoleLab/Small1.txt
@@ -0,0 +1,11 @@
+129 7 3 1.3 7.5 0
+
+36 69 1 11.41 32 5.76
+
+7 41 1 4.6 15 5.76
+
+150 61 2 6.75 23 0
+
+112 17 1 3.84 15 0
+
+80 112 6 1.64 9.5 0 \ No newline at end of file