summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BlankConsoleLab/BlankConsoleLab.vcxproj5
-rw-r--r--BlankConsoleLab/BlankConsoleLab.vcxproj.filters7
-rw-r--r--BlankConsoleLab/CST116-Lab2-Flowchart.txt132
3 files changed, 142 insertions, 2 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj b/BlankConsoleLab/BlankConsoleLab.vcxproj
index d2e3ee2..8a4889d 100644
--- a/BlankConsoleLab/BlankConsoleLab.vcxproj
+++ b/BlankConsoleLab/BlankConsoleLab.vcxproj
@@ -139,7 +139,10 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="BlankConsoleLab.cpp" />
+ <ClCompile Include="CST116 -Lab2-Hill.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <Text Include="CST116-Lab2-Flowchart.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters
index aca1dd9..404367f 100644
--- a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters
+++ b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters
@@ -15,8 +15,13 @@
</Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="BlankConsoleLab.cpp">
+ <ClCompile Include="CST116 -Lab2-Hill.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
+ <ItemGroup>
+ <Text Include="CST116-Lab2-Flowchart.txt">
+ <Filter>Source Files</Filter>
+ </Text>
+ </ItemGroup>
</Project> \ No newline at end of file
diff --git a/BlankConsoleLab/CST116-Lab2-Flowchart.txt b/BlankConsoleLab/CST116-Lab2-Flowchart.txt
new file mode 100644
index 0000000..58171d1
--- /dev/null
+++ b/BlankConsoleLab/CST116-Lab2-Flowchart.txt
@@ -0,0 +1,132 @@
+
+// OUTPUT //
+
+Please enter a temperature between -80 to 121 degrees fahrenheit, or -62 and 49.5 degrees celsius.
+Example entries: -32.3 F, 27.8 C
+
+-32 Z
+
+Invalid temperature system. Please try again with C or F as your unit.
+-81 F
+
+Temperature in fahrenheit must be between -80 and 121 degrees. Please try again.
+122 F
+
+Temperature in fahrenheit must be between -80 and 121 degrees. Please try again.
+-63 C
+
+Temperature in celsius must be between -62 and 49.5 degrees. Please try again.
+50 C
+
+Temperature in celsius must be between -62 and 49.5 degrees. Please try again.
+32 F
+
+Next, enter a wind speed between 0 and 231mph. You do not need to include a unit.
+11.3
+
+Conversions for 32F with wind speed 11.3MPH.
+
+Celsius Fahrenheit Wind Speed Wind Chill (F) Wind Chill (C)
+0.00 32.00 11.30 23.10 -4.95
+
+// PSEUDOCODE //
+
+DEFINE FUNCTION THAT RETURNS A FLOAT VALUE ConvertTemperature(float temperature, char temperatureSystem){
+
+ IF temperatureSystem is C{
+
+ RETURN (temperature * 1.8) + 32;
+
+ } ELSE IF temperatureSystem is F{
+
+ RETURN (temperature -32) / 1.8;
+
+ }
+
+}
+
+DEFINE FUNCTION THAT RETURNS A BOOL VALUE CheckWindSpeed(reference float value){
+
+ IF value IS LESS THAN 0 OR value IS GREATER THAN 231{
+
+ print "Invalid wind speed. Please enter a number between 0 and 231";
+ RETURN FALSE;
+
+ }
+ OTHERWISE RETURN TRUE;
+
+}
+
+DEFINE FUNCTION THAT RETURNS A FLOAT VALUE GetWindChill(){
+
+ RETURN (35.74 + (0.6215 * temperatureFahrenheit) + (windSpeed^0.16 * (0.4275 * temperatureFahrenheit) - 35.75));
+
+}
+
+MAIN PROGRAM(){
+
+ PRINT "Please enter a temperature between -80 to 121 degrees fahrenheit, or -62 and 49.5 degrees celsius.";
+ PRINT "Example entries: -32.3 F, 27.8 C";
+
+ INITIALIZE FLOAT temperatureInput;
+ INITIALIZE CHAR temperatureSystem;
+
+ INITIALIZE BOOL validEntires AT false;
+
+ DO AT LEAST ONCE{
+
+ PUT INPUT INTO temperatureInput AND temperatureSystem;
+
+ IF temperatureSystem IS 'C' {
+
+ IF temperatureInput IS LESS THAN -62 OR temperatureInput IS GREATER THAN 49.5{
+
+ PRINT "Temperature in celsius must be between -62 and 49.5 degrees. Please try again.";
+
+ }OTHERWISE{
+
+ SET validEntries TO true;
+ SET temperatureCelsius TO temperatureInput;
+ SET temperatureFahreneheit TO RETURN VALUE FROM ConvertTemperature WITH PARAMETERS temperatureINPUT and 'C';
+
+ }
+ }
+ OTHERWISE IF temperatureSystem IS 'F' {
+
+ IF temperatureInput IS LESS THAN -80 OR temperatureInput IS GREATER THAN 121{
+
+ PRINT "Temperature in fahrenheit must be between -80 and 121 degrees. Please try again.";
+
+ }OTHERWISE{
+
+ SET validEntries TO true;
+ SET temperatureFahrenheit TO temperatureInput;
+ SET temperatureCelsius TO RETURN VALUE FROM ConvertTemperature WITH PARAMETERS temperatureINPUT and 'F';
+
+ }
+
+
+ }WHILE validEntries IS false;
+
+ PRINT "Next, enter a wind speed between 0 and 231mph. You do not need to include a unit.";
+
+ RESET validEntries BY SETTING IT TO false;
+
+ DO AT LEAST ONCE {
+
+ PUT INPUT INTO windSpeed;
+
+ SET validEntries TO RETURN VALUE FROM CheckWindSpeed WITH PARAMETER windSpeed;
+
+ }WHILE validEntires IS false;
+
+ SET windChillFahrenheit TO RETURN VALUE FROM GetWindChill;
+ SET windChillCelsius TO RETURN VALUE FROM ConvertTemperature WITH PARAMETERS windChillFahrenheit AND 'F';
+
+ PRINT "Conversions for [TEMPERATURE INPUTTED BY USER] with wind speed [WIND SPEED ENTERED BY USER]MPH.";
+
+ PRINT [FORMATTED TABLE WITH HEADERS FOR TEMPERATURE IN CELSIUS AND FAHRENHEIT, WIND SPEED, AND CALCULATED WIND CHILL];
+
+ END PROGRAM;
+
+} \ No newline at end of file