The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.

QuickLearner_ProblemSolvingProgramDesign

Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by Juhaina, 2023-09-03 23:06:22

QuickLearner PSPD

QuickLearner_ProblemSolvingProgramDesign

95 Chapter 4 | Basic Programming Codes 4.9 Construct a based on given programming code. 1 2 3 4 5 6 START INPUT no1 INPUT no2 avg – (no1+ no2) /2 Display avg END Prompt user “Input the first number” Prompt user “Input the second number” 1 2 3 4 5 6 Pseudo code to calculate average of two input numbers Flowchart to calculate average of two input numbers How it works? Mapping each of the number from the pseudo code to the number from the flowchart. Each of the number show the conversion from the command in pseudo code to the symbol in flowchart.


96 Chapter 4 | Basic Programming Codes Activity 4.2 Answer 5. Output : 6. Input : no1, no2 Process : avg = (no1 + no2) /2 Output : avg Question : 1. Create a file average.cpp 2. Write the program code 3. Compile the program 4. Generate the output from the program 5. Write the output of the program 6. Identify the input, process and output of the program.


97 Chapter 4 | Basic Programming Codes Exercise 4.2 Answer Output : Question : Arrange the scrambled up snippet code to make a working C++ program that produce the output listed.


98 Chapter 4 | Basic Programming Codes Exercise 4.3 Answer a) Pseudocode b) Flowchart Question : Write a pseudocode and draw a flowchart for based on the above program code.


99 Chapter 4 | Basic Programming Codes Exercise 4.4 Answer Task 1 : INPUT : PROCESS : OUTPUT: Task 2 : Flowchart Question : Follow the process below in completing your codes. Task 1: You must identify the input, process and output from the given task Task 2: Construct a flowchart of the given task based on Task 1. Task 3: Construct a pseudocode of the given task based on Task 2. Task 4: Write a complete code of the given task based on Task 3. Miss Amelia are given you a task to help Finance department in completing payroll system. There will be 10% increment for gross pay salary for each staff. Create a program code to calculate the new salary for each staff including the allowance. Answer Task 3 : Task 4 :


Kenneth. C. L. &. Kenneth. A. L. (2020). Programming Languages: Principles and Practices (Advanced Topics) 3rd Edition. Cengage Learning. Somashekara. M.T., Guru. D. S., &. Manjunatha. K. S. (2018). Problem Solving with C (2nd Edition). India. PHI Learning. Wan Mohammad, W.A, Mohd Mydin, A. and Ishak, S. (2015). Introduction to C++ Programming. Shah Alam. Oxford University Press. Yew, K.H. (2018). Fundamentals of Programming. Shah Alam. Oxford Fajar. Unsplash. (n.d.). Beautiful free images & pictures. Unsplash. Retrieved November 18, 2021, from https://unsplash.com/. REFERENCES


101


Click to View FlipBook Version