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

Algorithm Toreisia Johnson

1. The document provides instructions for a Form 4 assignment involving algorithms. Students are asked to answer questions about algorithms, identify variables and data types, explain operators, and write simple algorithms to solve problems. 2. The problems involve calculating things like the talk time on a phone card based on price, finding the average price of items, calculating sales bonuses, and determining the cost of a phone bill. 3. Students are asked to include appropriate variables, operators, and output statements in their algorithms and may receive extra credit for including specified words in the final output statement.

Uploaded by

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

Algorithm Toreisia Johnson

1. The document provides instructions for a Form 4 assignment involving algorithms. Students are asked to answer questions about algorithms, identify variables and data types, explain operators, and write simple algorithms to solve problems. 2. The problems involve calculating things like the talk time on a phone card based on price, finding the average price of items, calculating sales bonuses, and determining the cost of a phone bill. 3. Students are asked to include appropriate variables, operators, and output statements in their algorithms and may receive extra credit for including specified words in the final output statement.

Uploaded by

Tiffany16
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Form 4 Assignment

Answer all questions on this sheet, save as Algorithm your name.


Name: Toreisia Johnson
Form: 4 Aristotle
1. Give the answer to each of the following:
a. 10 DIV 3 = 3
b. 5 MOD 3 = 2
c. 9 MOD 3 = 0
d. 15/2 = 7.5
e. (13 DIV 3) * (11 MOD 2) = 4
2. Complete the table below by suggesting an identifier (variable name) and data
type to match each description:
Description of data to be stored
Identifier
Data Type
The number of coins in a bag
thenumberofcoins
String
Whether a person can vote or not
Canvoteornot
String
The address of a shopper
theaddress
String
The percentage discount on an item
thepercentagediscount
String
A students exam mark
exammark
String
The cost of a movie ticket
thecost
String
3. Consider the following algorithm and answer the questions that follow.
Line 1:
START
Line 2:
pricePerMinute3
Line 3:
OUTPUT Please enter the phone card price
Line4:
INPUT phoneCardPrice
Line6:
talkTime phoneCardPrice DIV pricePerMinute
Line7:
OUTPUT talkTime
Line8:
STOP
a. Identify each of the following
i. A statement that will be displayed on the screen- A statement that
will be displayed on the screen is:
Enter your price per minute: 3
ii. The name of the constant and its value- The name of the constant
and its value is:
The constant is=minute
The value of the constant is=60
iii. An arithmetic operator- An arithmetic operator is:
DIV

iv. The names of TWO different variables- The names of two different
variables are:
1. Price
2. Enter
b. Explain the following:

Form 4 Assignment
Answer all questions on this sheet, save as Algorithm your name.
i. : This backward arrow is present in the Algorithm in question 3 at
Line 2, in line 2 consists of the OUTPUT needed to solve for the
problem. The backward arrow is showcasing or directing that 3 is
the price per minute, which is the OUTPUT or raw information
needed to complete the task.
ii. DIV: DIV is used in integer division, for example: 10 DIV3, which
is equal to 3, in this case, 10 and 3 would be referred to as the
integers. DIV is an Arithmetical operator which takes two operands
of integral type, performs integral division, and the results is a
value of integral type. In the algorithm contained in question 3, you
are going to DIV the phone card price and the price per minute
which is the talk time. When you are working out the algorithm to
solve for the problem, you are required to DIV the numbers.
4. Write simple algorithms (similar to QU 3 but without the line labels)using the
appropriate VARIABLE NAMES and OPERATORS for each of the following
problems. (It may help to think of each as a maths problem first)
a. To find the average price of three items in a shop.
b. To calculate the bonus a salesman receives if he/she gets 12% of his/her
total sales as a bonus
c. To calculate the area of a triangle.
d. To calculate the amount of a phone bill if calls cost 49c per call. Extra
credit if you can show the amount in $ instead of cents.
EXTRA CREDIT WILL BE GIVEN IF YOUR FINAL OUTPUT STATEMENT CONTAINS
WORDS AND VARIABLES AS GIVEN IN CLASS.
Answers for Question 4.
a. To find the average price of three items in a shop
START
OUTPUT
INPUT
newprice
OUTPUT
STOP

Enter the average price of three items in a shop


averageprice
+priceofthreeitems DIV 3
newprice

b. To calculate the bonus a salesman receives if he/she gets 12% of his/her total
sales as a bonus
START
OUTPUT
INPUT
newprice
OUTPUT

Enter the total sales as a bonus of the salesman


totalsalesbonus
salesbonus * 0.12
newprice

Form 4 Assignment
Answer all questions on this sheet, save as Algorithm your name.
c. To calculate the area of a triangle
START
OUTPUT
INPUT
Area
OUTPUT
STOP

Enter the three measurements of the triangle


threemeasurements
halfbase * height
area

d. To calculate the amount of a phone bill if calls cost 49c per call. Extra credit if you
can show the amount in $ instead of cents.
START
OUTPUT
INPUT
phonebill
OUTPUT
STOP

Enter the amount of a phone bill if calls costs 49c per call
amount
amountcosts * 49
The phonebill are $, phonebill

You might also like