0% found this document useful (0 votes)
13 views

Basic Pseudocode Practice 1

Uploaded by

Arooj Abid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Basic Pseudocode Practice 1

Uploaded by

Arooj Abid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Pseudocode Practice

Write codes that fulfill the following requirements:

Difficulty Level: Easy


1. Ask the user for a name. After that, OUTPUT “Hello, (the name where the user has typed
in).

2. Create a variable call MEALCOST. Assign a value of 10 to it.


Then, create another variable call MEALSELLINGPRICE, which is twice the value of
MEALCOST.
Then, create another variable call TAX, which is 6% of the MEALSELLINGPRICE.
Lastly, create a variable call TOTALPRICE, which is the sum of MEALSELLINGPRICE and TAX.

---------------------------------- BADGE EARNED!! Current rank: Beginner ---------------------------------

Difficulty Level: Medium


3. DECLARE a dynamic array, named it as Y10CLASS, which will be used to contain a list of
names.

4. Design a program that asks a user to INPUT two numbers. The program will multiply the
numbers together (hint: you need to create a variable that stores the product). If the
product is larger than 100 it outputs the message “Greater than 100”. If not, it does nothing.

--------------------------------- BADGE EARNED!! Current rank: Amatuer --------------------------------

1
Pseudocode Practice

Difficulty Level: Hard


5. Fries are sold in the canteen at $3 each, if 10 fries are bought then the discount is
5%, if 20 fries are bought the discount is 15%. No more than 30 fries can be bought
in a single transaction (hint: A while loop can be used for validation (eg. Fries
number cannot be less than 1 or more than 30).

(Do not use CASE OF, use IF ... ELSE ... THEN instead)

You are asked to design a program that can automatically calculate the cost of the
purchase. Print out the cost. The program will keep repeating until a user INPUT a
value "stop". Write the pseudocode for this program.

WHILE Continue <> “STOP” DO

WHILE NumberOfFries < 1 OR NumberOfFries > 30 DO


INPUT NumberOfFries

IF NumberOfFries > 10
THEN
IF NumberOfFries > 20
THEN
Discount <- 0.15
ELSE
Discount <- 0.05
ENDIF
ELSE
Discount <- 0
ENDIF

TOTALFRIESPRICE <- NumberOfFries * 3 * (1 – Discount)


OUTPUT TOTALFRIESPRICE

INPUT Continue

2
Pseudocode Practice

------------------------------------ LEVEL UP!! Current rank: Professional ----------------------------------


Standard methods of solution

1. Totaling

StudentMark [1:10]
70 75 80 60 70 65 75 90 95 100

Write the pseudocode to find the total mark:

2. Counting

StudentMark [1:10]
70 75 80 60 70 65 75 90 95 100

Write the pseudocode to find the number of students who pass (mark > 50) the exam.

3
Pseudocode Practice

You might also like