diff options
| author | Birducken <[email protected]> | 2022-11-29 14:16:36 -0800 |
|---|---|---|
| committer | Birducken <[email protected]> | 2022-11-29 14:16:36 -0800 |
| commit | 76afbcff67b47f4d81b110b37ceb5c6d267fb804 (patch) | |
| tree | 9d1908d4826f5cce788a4c09ac3beb3ee7b5720e /BlankConsoleLab | |
| parent | Finished. (diff) | |
| download | archived-cst116-lab3-stark-master.tar.xz archived-cst116-lab3-stark-master.zip | |
Diffstat (limited to 'BlankConsoleLab')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.vcxproj | 153 | ||||
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.vcxproj.filters | 27 | ||||
| -rw-r--r-- | BlankConsoleLab/cst116-lab3-stark-psuedo-code.txt | 27 | ||||
| -rw-r--r-- | BlankConsoleLab/cst116-lab3-stark.cpp | 81 | ||||
| -rw-r--r-- | BlankConsoleLab/large.txt | 48 | ||||
| -rw-r--r-- | BlankConsoleLab/small.txt | 6 |
6 files changed, 0 insertions, 342 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj b/BlankConsoleLab/BlankConsoleLab.vcxproj deleted file mode 100644 index 0cd3fe0..0000000 --- a/BlankConsoleLab/BlankConsoleLab.vcxproj +++ /dev/null @@ -1,153 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <VCProjectVersion>16.0</VCProjectVersion> - <Keyword>Win32Proj</Keyword> - <ProjectGuid>{3cecade6-3e15-4852-bd24-65bfe5d3a3aa}</ProjectGuid> - <RootNamespace>BlankConsoleLab</RootNamespace> - <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> - <ProjectName>cst116-lab3-stark</ProjectName> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v143</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <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>v143</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v143</PlatformToolset> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="Shared"> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>true</LinkIncremental> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <LinkIncremental>false</LinkIncremental> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <LinkIncremental>true</LinkIncremental> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <LinkIncremental>false</LinkIncremental> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <SDLCheck>true</SDLCheck> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <SDLCheck>true</SDLCheck> - <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - <GenerateDebugInformation>true</GenerateDebugInformation> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <SDLCheck>true</SDLCheck> - <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <SDLCheck>true</SDLCheck> - <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ConformanceMode>true</ConformanceMode> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - <GenerateDebugInformation>true</GenerateDebugInformation> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="cst116-lab3-stark.cpp" /> - </ItemGroup> - <ItemGroup> - <Text Include="cst116-lab3-stark-psuedo-code.txt" /> - <Text Include="large.txt" /> - <Text Include="small.txt" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project>
\ No newline at end of file diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters deleted file mode 100644 index 246f02a..0000000 --- a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="Header Files"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions> - </Filter> - <Filter Include="Resource Files"> - <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="cst116-lab3-stark.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <Text Include="small.txt" /> - <Text Include="large.txt" /> - <Text Include="cst116-lab3-stark-psuedo-code.txt" /> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/BlankConsoleLab/cst116-lab3-stark-psuedo-code.txt b/BlankConsoleLab/cst116-lab3-stark-psuedo-code.txt deleted file mode 100644 index ca35e98..0000000 --- a/BlankConsoleLab/cst116-lab3-stark-psuedo-code.txt +++ /dev/null @@ -1,27 +0,0 @@ -Trenton Stark -CST 116 -Lab 3 Psuedo Code - -Initialize a 50 element array (fares) with all 0s -Initialize totalPass = 0 - -Prompt the user for a file name (fName) and open prompted file, if file can't be opened print warning and loop, - -Print header row for table -for each line in file: - Read line into variables pick, drop, pass, dist, fare, and toll - total = fare + toll - if dist = 0: - cosMi = 0 - else: - cosMi = fare / dist - - print row with pick, drop, pass, dist, fare, toll, total, and cosMi - - totalPass = totalPass + pass - store fare into corresponding element of fares[] array - -totalPaid = sum of all elements in fares[] -average = totalPaid / total pass - -Print totalPass, totalPaid, and average diff --git a/BlankConsoleLab/cst116-lab3-stark.cpp b/BlankConsoleLab/cst116-lab3-stark.cpp deleted file mode 100644 index b4cca4c..0000000 --- a/BlankConsoleLab/cst116-lab3-stark.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// Trenton Stark -// CST 116 -// Lab 3 - -#include <iostream> -#include <fstream> -#include <string> -#include <iomanip> - -using std::cout; -using std::cin; -using std::endl; -using std::ifstream; -using std::string; -using std::setw; -using std::setprecision; -using std::fixed; - -const int width = 10; //Affects all tables - -void readFile(ifstream& fin, double fares[], int& totalPass); -void summary(double fares[], int& totalPass); - -int main() { - ifstream fin; - string fName; - double fares[50] = { 0 }; //Initializes all cells to 0 - int totalPass = 0; - - //Loops prompt until user enters openable file - do { - cout << "Input file name: "; - cin >> fName; - fin.open(fName); - if (!(fin.is_open())) { - cout << "File couldn't be opened. Try again." << endl; - } - } while (!(fin.is_open())); - cout << endl; - - cout << setw(width) << "Pick:" << setw(width) << "Drop:" << setw(width) << "Pass #:" << setw(width) << "Dist:" << setw(width) << "Fare:" << setw(width) << "Toll:" << setw(width) << "Total:" << setw(width) << "Cost/Mi:" << endl; - readFile(fin, fares, totalPass); //Inputs data into fares and totalPass while printing out file contents - summary(fares, totalPass); //Uses fares and totalPass to create a summary -} - -void readFile(ifstream& fin, double fares[], int& totalPass) { - int i = 0; - int pick, drop, pass; - double dist, fare, toll, total, cosMi; - - cout << fixed << setprecision(2); //Formats the output down to two decimal points - while (!(fin.eof())) { - fin >> pick >> drop >> pass >> dist >> fare >> toll; - total = fare + toll; - if (dist == 0) { //Checks if there will be a division by zero, if so set cosMi to 0 - cosMi = 0; - } - else { - cosMi = fare / dist; - } - cout << setw(width) << pick << setw(width) << drop << setw(width) << pass << setw(width) << dist << setw(width) << fare << setw(width) << toll << setw(width) << total << setw(width) << cosMi << endl; - - totalPass += pass; - fares[i] = total; - i++; - } - cout << endl; -} - -void summary(double fares[], int& totalPass) { - float totalPaid = 0, average; //Totals paid must start as zero because each cell is added to the total - int i; - for (i = 0; i < 50; i++) { //Adds all cells regardless of how many were written because unwritten cells will be 0 - totalPaid += fares[i]; - } - average = totalPaid / totalPass; - - cout << "Total Passangers: " << totalPass << endl; - cout << "Total Fares: " << totalPaid << endl; - cout << "Mean fare per passanger: " << average << endl; -} diff --git a/BlankConsoleLab/large.txt b/BlankConsoleLab/large.txt deleted file mode 100644 index 1c3dbbb..0000000 --- a/BlankConsoleLab/large.txt +++ /dev/null @@ -1,48 +0,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 -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 diff --git a/BlankConsoleLab/small.txt b/BlankConsoleLab/small.txt deleted file mode 100644 index 840aa56..0000000 --- a/BlankConsoleLab/small.txt +++ /dev/null @@ -1,6 +0,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
\ No newline at end of file |