From 1f7c898ea3a75ecef08c81ca7bb66703b43db53c Mon Sep 17 00:00:00 2001 From: JacobAKnox <91796123+JacobAKnox@users.noreply.github.com> Date: Wed, 6 Oct 2021 19:50:26 -0700 Subject: psudocode corrections --- 3b/psudocode.txt | 2 +- 3b/psudocodeCorrections.txt | 59 +++++++++++++++++++++++++++++++++++++++++++++ 4.1Exercises.txt | 7 ++++++ 4.3Exercies.txt | 16 ++++++++++++ 6.1Exercies.txt | 8 ++++++ 5 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 3b/psudocodeCorrections.txt create mode 100644 4.1Exercises.txt create mode 100644 4.3Exercies.txt create mode 100644 6.1Exercies.txt diff --git a/3b/psudocode.txt b/3b/psudocode.txt index 5696f5e..611baf9 100644 --- a/3b/psudocode.txt +++ b/3b/psudocode.txt @@ -4,4 +4,4 @@ len = string.len out = "" for i = len-1; i < 0; i-- out += s[i] -retrun out \ No newline at end of file +retrun out diff --git a/3b/psudocodeCorrections.txt b/3b/psudocodeCorrections.txt new file mode 100644 index 0000000..4e03625 --- /dev/null +++ b/3b/psudocodeCorrections.txt @@ -0,0 +1,59 @@ +1. +Display "Enter old wage: " +Read Old_wage + +New_wage = Old_wage * .06 + +Display Old_wage +Display "+6%=" +Display New_wage + +fixed + +Display "Enter old wage: " +Read Old_wage + +New_wage = Old_wage * 1.06 //old version would output 6% of the old wage when you want 106% of the old wage + +Display Old_wage +Display "+6%=" +Display New_wage + +2. +Display "Enter Assignment average: " +Read Assignment_avg + +Display "Enter Test 1:" +Read Test1 + +Display "Enter Test 2:" +Read Test2 + +Display "Enter Tes1 3:" +Read Test3 + +Test_avg = Test1 * 0.15 + Test2 * 0.15 + Test3 * 0.15/3 +Class_score = Assign_avg * 0.2 + Test_avg * 0.4 + Final * 0.25 + +Display "Final score: " +Displace Class_score + +fixed +Display "Enter Assignment average: " +Read Assignment_avg + +Display "Enter Test 1:" +Read Test1 + +Display "Enter Test 2:" +Read Test2 + +Display "Enter Tes1 3:" +Read Test3 + +Test_tot = Test1 * 0.15 + Test2 * 0.15 + Test3 * 0.15 //gives a value between 0 and 0.45 based on how well you did on the tests +Class_score = Assign_avg * 0.25 + Test_tot + Final * 0.25 //tests are already in the 0-1 range needed for this calculation and do not need to be multiplied, assignments are 25% of the grade +Converted_score = Class_score * 100 //convert the score to a 0-100 range for easier readability, peresonal prefrence + +Display "Final score: " +Displace Converted-score // print the converted score instead diff --git a/4.1Exercises.txt b/4.1Exercises.txt new file mode 100644 index 0000000..dc795b0 --- /dev/null +++ b/4.1Exercises.txt @@ -0,0 +1,7 @@ +1. -12.34 numeric +2. 'Hello' illegal +3. "F" String +4. "1234" String +5. '1' Character +6. A illegal +7. "Marcus' illegal diff --git a/4.3Exercies.txt b/4.3Exercies.txt new file mode 100644 index 0000000..e002437 --- /dev/null +++ b/4.3Exercies.txt @@ -0,0 +1,16 @@ +3. +a. int a, int b; + There should not be a second "int" after the comma +b. int a = b; + int b = 0; + A cannot be assigned the value b before be is declared +c. int a = 0, b = 3.5; + b is not an int +d. char grade = "A"; + '"A"' is a string not a char +e. char c = 1; + 1 is a numerical value not a char +f. int a, b, c, d, f; + No error +g. char x = "This is a test."; + '"This is a test."' is a string not a char diff --git a/6.1Exercies.txt b/6.1Exercies.txt new file mode 100644 index 0000000..7fe832c --- /dev/null +++ b/6.1Exercies.txt @@ -0,0 +1,8 @@ +1. y = 5x + 1; + valid statement +2. x^2 + 2x + 1 = 0; + invalid assignment can only be done on a lone variable to the left of an = +3. x = 5 * a + 4; + valid statement +4. 0 = -15 * b; + invalid variable names cannot be numerical literals -- cgit v1.2.3