Pseudo Code Computer Science Pre-release 2019
- Created by: Leary103
- Created on: 04-02-19 05:29
Task 1 Part 1
DECLARE amount : INTEGER
amount ← 0
WHILE amount < 10
INPUT “Please enter the amount of auction items: “ amount
IF amount < 10
OUTPUT "The minimum value must be 10 or more."
ENDIF
ENDWHILE
Task 1 Part 2
DECLARE item_numbers : ARRAY[0:amount] OF INTEGER
DECLARE descriptions : ARRAY[0:amount] OF STRING
DECLARE reserve_price : ARRAY[0:amount] OF REAL
DECLARE bid_numbers : ARRAY[0:amount] OF INTEGER
Task 2 Part 1
DECLARE buyers : ARRAY[0:amount] OF STRING
DECLARE recorded_bids : ARRAY[0:amount] OF INTEGER
Task 1 Part 3
DECLARE item_code : INTEGER
DECLARE item : STRING
DECLARE reserve : REAL
DECLARE no_of_bids : INTEGER
Task 2 Part 2
DECLARE answer : STRING
DECLARE search : INTEGER
DECLARE bid : REAL
DECLARE buyer_id : STRING
DECLARE found : BOOLEAN
Task 3 Part 1
DECLARE fee : REAL
DECLARE total_fee : REAL
DECLARE total_sold : INTEGER
DECLARE total_no_reserve : INTEGER
DECLARE total_no_bids : INTEGER
Task 1 Part 4
item_code ← 0
item ← ""
reserve ← 0.0
no_of_bids ← 0
Task 2 Part 3
answer ← ""
search ← 0
bid ← 0.0
buyer_id ← ""
found ← False
Task 3 Part 2
fee ← 0.0
total_fee ← 0.0
total_sold ← 0
total_no_reserve ← 0
total_no_bids ← 0
Task 1 Part 5
FOR index ← 1 TO amount
item_code = item_code + 1
item_numbers[index] = item_code
INPUT “Please enter your item description: “ item
descriptions[index] = item
INPUT "What is your reserve?: " reserve
reserve_price[index] = reserve
bid_numbers[index] = no_of_bids
Task 1 Part 6
OUTPUT "Added item: ", item
OUTPUT "Reserve price: ", reserve
OUTPUT "Item number: ", item_code
ENDFOR
Task 2 Part 4
WHILE answer <> "end"
INPUT “Enter item number: “ search
FOR index ← 1 TO amount:
IF item_numbers[index] = search
found ← True
Task 2 Part 5
OUTPUT "You found: ", descriptions[index]
OUTPUT “Highest current bid: ", recorded_bids[index]
OUTPUT "Bidder: ", buyers[index]
OUTPUT “Number of bids: ", bid_numbers[index]
INPUT "Please enter your buyer ID: " buyer_id
INPUT "Please enter your bid: " bid
IF bid > recorded_bids[index]:
OUTPUT “You are currently the highest bidder!"
recorded_bids[index] = bid
buyers[index] = buyer_id
bid_numbers[index] = bid_numbers[index] + 1
Task 2 Part 6
BREAK
ELSE
OUTPUT "Sorry, your bid is too low."
BREAK
ENDIF
ELSE
found ← False
ENDIF
ENDFOR
Task 2 Part 7
IF found = False:
OUTPUT "Sorry, could not find item."
ENDIF
OUTPUT "Would you like to make another bid?”
INPUT “Type 'end' to end the auction " answer
ENDWHILE
Task 3 Part 3
FOR index ← 1 TO amount
IF recorded_bids[index] >= reserve_price[index]
fee ← recorded_bids[index] * 0.1
total_fee ← total_fee + fee
total_sold ← total_sold + 1
ELSE
IF recorded_bids[index] < reserve_price[index] AND
bid_numbers[index] > 0
OUTPUT "Item number", item_numbers[index], "did not
reach the reserve price of", reserve_price[index]
Task 3 Part 4
OUTPUT "The highest bid was", recorded_bids[index]
total_no_reserve ← total_no_reserve + 1
ELSE
OUTPUT "Item number", item_numbers[index], "did not
receive any bids."
total_no_bids ← total_no_bids + 1
Task 3 Part 5
OUTPUT "The total items sold is", total_sold
OUTPUT "The total fee for all sold items is, ", total_fee
OUTPUT "The total items that did not meet the reserve price is", total_no_reserve
OUTPUT "The total items with no bids is", total_no_bids
Related discussions on The Student Room
- Computer Science AQA Pre release 2024 A level »
- Computing science for GCSE »
- I don't know what to pick for my A-Levels »
- Formulae sheets in 2024? »
- AQA A Level chemistry 2023 grade boundary predictions »
- Edexcel A level business 2023 »
- AQA A-Level Computer Science NEA grade boundaries »
- BTEC Business Level 3 Unit 6 Principles of Management Pre-release »
- Alevel Business edexel paper 3 »
- Amazon Question For Pre Order Game »
Comments
Report
Report
Report
Report
Report
Report