Critical Thinking and Problem Solving

Critical Thinking and Problem Solving
Instructions
? Answer all the following five questions.
? Place your answers in a pdf document.
? Submit your assignment answers via the portal.
? Five marks are allocated to following instructions accurately.
[5 marks]
Questions
1. Usually a defining diagram is developed before an algorithm, however in this question you need to work backwards. What is a suitable defining diagram for the following algorithm?
ASSIGNMENT_1_ALGORITHM
//get a number between 1 and 12 inclusive
DISPLAY “Please type a number between 1 and 12 inclusive:”
GET n
//check the validity of n
DOWHILE (n < 1 OR n > 12)
DISPLAY “Sorry, your number is invalid”
DISPLAY “Please type a number between 1 and 12 inclusive:”
GET n
ENDDO
//display headings
DISPLAY “y=nx+n |”
x = 1
DOWHILE x < 11
DISPLAY x in a field of 4 characters
x = x + 1
ENDDO
DISPLAY a return character to start a new line
//display heading underlines
DISPLAY “========”
x = 1
DOWHILE x < 11
DISPLAY “====”
x = x + 1
ENDDO
DISPLAY a return character to start a new line
//compute and display something
y = 1
DOWHILE y < n + 1
DISPLAY y in a field of 6 characters
DISPLAY “ |”
x = 1
DOWHILE x < 11
z = y * x + y
DISPLAY z in a field of 4 characters
x = x + 1
ENDDO
DISPLAY a return character to start a new line
y = y + 1
ENDDO
END //end algorithm
[10 marks]
Page 2 of 2
2. What is the output of the algorithm above when the input is
i. 0
ii. 7
iii. 12
iv. 15
[2+3+3+2=10 marks]
3. Rewrite the algorithm from Question 1 into 6 modules (one main module and 5 others). Use the embedded comments clearly indicated in red to help you identify individual tasks.
[10 marks]
4. Develop an algorithm that receives a student ID number, a mark out of 100 for an assignment, and a mark out of 50 for an exam. The algorithm should calculate the final grade for the student given that the assignment is worth 40% of the final mark and the exam is worth 60%. Using a CASE statement, the algorithm should then determine the student grade according to the following mark ranges: MARK RANGE GRADE 0-50 F 51-60 P 61-70 C 71-80 D 81-100 HD The algorithm should display to the screen the student ID, the final mark, and the associated grade. For example, a student with ID 34839, an assignment mark of 87, and an exam mark of 35 would give output: STUDENT ID FINAL MARK GRADE 34839 76.8 D Submit:
a. defining diagram and
b. algorithm for this question.
[5+10=15 marks]
5. Use the method of deduction to prove the following arguments are valid:
a. P ? ~Q ~(~Q V R) V S ~(T ? S) P & ~T
b. (P V Q) ? ~R P & S ~(R V ~S) ? T T
[2×10=10 marks]

PLACE THIS ORDER OR A SIMILAR ORDER WITH US TODAY AND GET AN AMAZING DISCOUNT 🙂

 

© 2020 customphdthesis.com. All Rights Reserved. | Disclaimer: for assistance purposes only. These custom papers should be used with proper reference.