aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lab2Harris-Toovy/Lab2 Textual work Harris-Toovy.txt75
-rw-r--r--Lab2Harris-Toovy/Lab2 console output Harris-Toovy.txt39
-rw-r--r--Lab2Harris-Toovy/Lab2Harris-Toovy.cpp100
-rw-r--r--Lab2Harris-Toovy/Lab2Harris-Toovy.vcxproj147
-rw-r--r--Lab2Harris-Toovy/Lab2Harris-Toovy.vcxproj.filters22
5 files changed, 383 insertions, 0 deletions
diff --git a/Lab2Harris-Toovy/Lab2 Textual work Harris-Toovy.txt b/Lab2Harris-Toovy/Lab2 Textual work Harris-Toovy.txt
new file mode 100644
index 0000000..2c67cf9
--- /dev/null
+++ b/Lab2Harris-Toovy/Lab2 Textual work Harris-Toovy.txt
@@ -0,0 +1,75 @@
+By Jordan Harris-Toovy for OIT's CST116-01P course lab 2, October 2021
+
+3a:
+[4.1]
+ 1) Good - Float
+ 2) Bad - Multiple characters within ' ' char designator, should be "Hello"
+ 3) Good - String
+ 4) Good - String
+ 5) Good - Character
+ 6) Bad - Not a literal (did they mean 0xA?) , should be 'A'
+ 7) Bad - Almost a string, but no ending ", should be "Marcus"
+
+[4.3]
+ a) 0 to 2^8 -1
+ b) 0 to 2^16 - 1
+ c) 0 to 2^32 - 1
+ d) -(2^63) to +(2^63 - 1)
+ e) -(2^15) to +(2^15 - 1)
+
+[6.1]
+ 1) Invalid - 5x is not a valid multiplication - should be: y = 5 * x + 1;
+ 2) Invalid - four errors: X� is not in ASCII, 5x is not a valid multiplication, the equality is on the right, and the equality is not 'pointing' into a variable - this mathematical expression cannot be implemented like this in C++
+ 3) Valid
+ 4) Invalid - the equality is not 'pointing' into a variable (0 is not an accessible memory location anyway) - this mathematical expression cannot be implemented like this in C++
+
+
+
+3b:
+ 1) The issue here is that +6% is x1.06 not x0.06!
+
+Display "Enter old wage: "
+Read Old_wage
+
+New_wage = Old_wage * 1.06
+
+Display Old_wage
+Display " +6% = "
+Display New_wage
+
+ 2) There are three problems with this code: One is that the test scores are scaled twice (once before averaging, once during the final average), another is that the final scaling factor for the tests is wrong (15*3=45 not 40), and finally the variable names are not consistent (E.G.: Assignment_avg and Assign_avg)
+
+Display "Enter assignment average: "
+Read Assignment_avg
+
+Display "Enter Test 1: "
+Read Test1
+
+Display "Enter Test 2: "
+Read Test2
+
+Display "Enter Test 3: "
+Read Test3
+
+Display "Enter Final: "
+Read Final
+
+Test_avg = ( Test1 + Test2 + Test3 ) / 3
+Class_score = Assign_avg * 0.3 + Test_avg * 0.45 + Final *0.25
+
+Display "Final score: "
+Display Class_score
+
+
+
+4a:
+ 1) a = 25
+ 2) a = 30
+ 3) a = 35
+ 4) a = 0
+ 5) a = 1
+ 6) a = 0.6
+ 7) Invalid syntax, would be a = 4 if rearranged
+
+
+
diff --git a/Lab2Harris-Toovy/Lab2 console output Harris-Toovy.txt b/Lab2Harris-Toovy/Lab2 console output Harris-Toovy.txt
new file mode 100644
index 0000000..2fec042
--- /dev/null
+++ b/Lab2Harris-Toovy/Lab2 console output Harris-Toovy.txt
@@ -0,0 +1,39 @@
+CONSOLE OUTPUT FOR CODE 3c (4.13#2):
+
+C
++
++
+
+C:\Users\jorda\Source\Repos\cst116-lab2-JordanHT-OIT\Lab2Harris-Toovy\Debug\Lab2Harris-Toovy.exe (process 4816) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+CONSOLE OUTPUT FOR CODE 3c (4.13#3):
+
+I am 8760 Days old.
+C:\Users\jorda\Source\Repos\cst116-lab2-JordanHT-OIT\Lab2Harris-Toovy\Debug\Lab2Harris-Toovy.exe (process 5336) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+CONSOLE OUTPUT FOR CODE 4a (5.4#1):
+
+Enter you body temperature: 98.775
+ 98.8
+C:\Users\jorda\Source\Repos\cst116-lab2-JordanHT-OIT\Lab2Harris-Toovy\Debug\Lab2Harris-Toovy.exe (process 3336) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+CONSOLE OUTPUT FOR CODE 4a (5.4#2):
+First Name GPA Class Major Credits
+Bob 3.23 Freshman Software Engineering 23
+Jamie 0.98 Freshman Underwater Basket 15
+Marcus 4.00 Freshman Management 3
+Phong 3.75 Junior Encryption 101
+Webster 2.00 Sophomore Wildlife Management 56
+
+C:\Users\jorda\Source\Repos\cst116-lab2-JordanHT-OIT\Lab2Harris-Toovy\Debug\Lab2Harris-Toovy.exe (process 11020) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
diff --git a/Lab2Harris-Toovy/Lab2Harris-Toovy.cpp b/Lab2Harris-Toovy/Lab2Harris-Toovy.cpp
new file mode 100644
index 0000000..3716e08
--- /dev/null
+++ b/Lab2Harris-Toovy/Lab2Harris-Toovy.cpp
@@ -0,0 +1,100 @@
+//Code by Jordan Harris-Toovy for OIT'S CST116-01P Lab 2 - October 2021
+//Un-comment blocks for each assignment (re-comment when finished)
+
+#include <iostream>
+#include <iomanip>
+
+//PART 3c - 4.13#2:
+/*
+using std::cout;
+
+int main()
+{
+ char ascii = 67;
+ cout << ascii << '\n';
+ ascii = 43;
+ cout << ascii << '\n';
+ cout << ascii << '\n';
+
+ return 0;
+}
+*/
+
+//PART 3c - 4.13#3:
+/*
+using std::cout;
+
+int main()
+{
+ int myAgeYears = 24;
+ int myAgeDays;
+ const int yearDays = 365;
+
+ myAgeDays = myAgeYears * yearDays;
+
+ cout << "I am " << myAgeDays << " Days old.";
+
+ return 0;
+}
+*/
+
+//PART 4a - 5.4#1:
+/*
+using std::cout;
+using std::cin;
+
+int main()
+{
+ float body_temp;
+ cout << "Enter you body temperature: ";
+ cin >> body_temp;
+
+ cout.setf(std::ios::fixed);
+ cout.width(6);
+ cout << std::setprecision(1) << body_temp;
+
+ return 0;
+}
+*/
+
+//PART 4a - 5.4#2:
+/*
+using std::cout;
+using std::cin;
+using std::setw;
+using std::endl;
+
+int main()
+{
+ const int padding1 = 15;
+ const int padding2 = 30;
+
+ cout.setf(std::ios::fixed);
+ cout.setf(std::ios::left);
+
+
+ cout << setw(padding1) << "First Name" << setw(padding1 - 5) << "GPA" << setw(padding1) << "Class" << setw(padding2)
+ << "Major" << setw(padding1) << "Credits" << endl;
+
+ cout << setw(padding1) << "Bob" << setw(padding1 - 5) << std::setprecision(2) << 3.23 << setw(padding1) << "Freshman" << setw(padding2)
+ << "Software Engineering" << setw(padding1) << std::setprecision(0) << 23 << endl;
+
+ cout << setw(padding1) << "Jamie" << setw(padding1 - 5) << std::setprecision(2) << 0.98 << setw(padding1) << "Freshman" << setw(padding2)
+ << "Underwater Basket" << setw(padding1) << std::setprecision(0) << 15 << endl;
+
+ cout << setw(padding1) << "Marcus" << setw(padding1 - 5) << std::setprecision(2) << 4.00 << setw(padding1) << "Freshman" << setw(padding2)
+ << "Management" << setw(padding1) << std::setprecision(0) << 3 << endl;
+
+ cout << setw(padding1) << "Phong" << setw(padding1 - 5) << std::setprecision(2) << 3.75 << setw(padding1) << "Junior" << setw(padding2)
+ << "Encryption" << setw(padding1) << std::setprecision(0) <<101 << endl;
+
+ cout << setw(padding1) << "Webster" << setw(padding1 - 5) << std::setprecision(2) << 2.00 << setw(padding1) << "Sophomore" << setw(padding2)
+ << "Wildlife Management" << setw(padding1) << std::setprecision(0) << 56 << endl;
+
+ return 0;
+}
+
+*/
+
+//PART 4a - 6.3#1
+//WORK IN PROGRESS \ No newline at end of file
diff --git a/Lab2Harris-Toovy/Lab2Harris-Toovy.vcxproj b/Lab2Harris-Toovy/Lab2Harris-Toovy.vcxproj
new file mode 100644
index 0000000..41e2359
--- /dev/null
+++ b/Lab2Harris-Toovy/Lab2Harris-Toovy.vcxproj
@@ -0,0 +1,147 @@
+<?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>{bfe423e7-6a30-4a96-834e-9be88ccbe4a6}</ProjectGuid>
+ <RootNamespace>Lab2HarrisToovy</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+ </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>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v142</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>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v142</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="Lab2Harris-Toovy.cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/Lab2Harris-Toovy/Lab2Harris-Toovy.vcxproj.filters b/Lab2Harris-Toovy/Lab2Harris-Toovy.vcxproj.filters
new file mode 100644
index 0000000..cf279b2
--- /dev/null
+++ b/Lab2Harris-Toovy/Lab2Harris-Toovy.vcxproj.filters
@@ -0,0 +1,22 @@
+<?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="Lab2Harris-Toovy.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file