diff options
| author | Jordan HarrisToovy <[email protected]> | 2021-10-10 17:14:01 -0700 |
|---|---|---|
| committer | Jordan HarrisToovy <[email protected]> | 2021-10-10 17:14:01 -0700 |
| commit | 3d40dafec7d5e47dadfb405d3988111b0fcd2209 (patch) | |
| tree | c5d257abfa63a9782c8ff81e41bd8d42422461a0 /Lab2Harris-Toovy/Lab2 Textual work Harris-Toovy.txt | |
| parent | Add online IDE url (diff) | |
| download | cst116-lab2-jordanht-oit-3d40dafec7d5e47dadfb405d3988111b0fcd2209.tar.xz cst116-lab2-jordanht-oit-3d40dafec7d5e47dadfb405d3988111b0fcd2209.zip | |
Intermediate commit to save work
Diffstat (limited to 'Lab2Harris-Toovy/Lab2 Textual work Harris-Toovy.txt')
| -rw-r--r-- | Lab2Harris-Toovy/Lab2 Textual work Harris-Toovy.txt | 75 |
1 files changed, 75 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 + + + |