diff options
| author | Jordan HarrisToovy <[email protected]> | 2021-10-10 18:31:11 -0700 |
|---|---|---|
| committer | Jordan HarrisToovy <[email protected]> | 2021-10-10 18:31:11 -0700 |
| commit | 1dbe334ebc840b23986388ddffc6cd827dee05e1 (patch) | |
| tree | 7dcc68ce66d2ad02a73fc03a21a73a03b3dd04a1 /CST116F2021-Lab2/Lab2-Textual_work.txt | |
| parent | Intermediate commit to save work (diff) | |
| download | cst116-lab2-jordanht-oit-master.tar.xz cst116-lab2-jordanht-oit-master.zip | |
Diffstat (limited to 'CST116F2021-Lab2/Lab2-Textual_work.txt')
| -rw-r--r-- | CST116F2021-Lab2/Lab2-Textual_work.txt | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/CST116F2021-Lab2/Lab2-Textual_work.txt b/CST116F2021-Lab2/Lab2-Textual_work.txt new file mode 100644 index 0000000..e3548f1 --- /dev/null +++ b/CST116F2021-Lab2/Lab2-Textual_work.txt @@ -0,0 +1,72 @@ +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 |