Wednesday, March 13, 2019

Pre Release May/June 2019 with comments




In preparation for the examination candidates should attempt the following practical tasks by writing and testing a program or programs.

An auction company has an interactive auction board at their sale rooms, which allows buyers to place bids at any time during the auction. Before the auction starts, the sellers place their items in the sale room with a unique number attached to each item (item number). The following details about each item need to be set up on the interactive auction board system: item number, number of bids, description and reserve price. The number of bids is initially set to zero.

During the auction, buyers can look at the items in the sale room and then place a bid on the interactive auction board at the sale room. Each buyer is given a unique number for identification (buyer number). All the buyer needs to do is enter their buyer number, the item number and their bid. Their bid must be greater than any existing bids.

At the end of the auction, the company checks all the items and marks those that have bids greater than the reserve as sold. Any items sold will incur a fee of 10% of the final bid to be paid to the auction company.

Write and test a program or programs for the auction company.

      Your program or programs must include appropriate prompts for the entry of data, data must be validated on entry.
     Error messages and other output need to be set out clearly and understandably.
     All variables, constants and other identifiers must have meaningful names.

You will need to complete these three tasks. Each task must be fully tested.

Task 1 Auction set up.

For every item in the auction the item number, description and the reserve price should be recorded. The number of bids is set to zero. There must be at least 10 items in the auction.

Task 2 – Buyer bids.

A buyer should be able to find an item and view the item number, description and the current highest bid. A buyer can then enter their buyer number and bid, which must be higher than any previously recorded bids. Every time a new bid is recorded the number of bids for that item is increased by one. Buyers can bid for an item many times and they can bid for many items.

Task 3 At the end of the auction.

Using the results from TASK 2, identify items that have reached their reserve price, mark them as sold, calculate 10% of the final bid as the auction company fee and add this to the total fee for all sold items. Display this total fee. Display the item number and final bid for all the items with bids that have not reached their reserve price. Display the item number of any items that have received no bids. Display the number of items sold, the number of items that did not meet the reserve price and the number of items with no bids.














Wednesday, March 6, 2019

O Level 2210 Pre Release + Solution May/June 2019

In preparation for the examination candidates should attempt the following practical tasks by writing and testing a program or programs.

An auction company has an interactive auction board at their sale rooms, which allows buyers to place bids at any time during the auction. Before the auction starts, the sellers place their items in the sale room with a unique number attached to each item (item number). The following details about each item need to be set up on the interactive auction board system: item number, number of bids, description and reserve price. The number of bids is initially set to zero.

During the auction, buyers can look at the items in the sale room and then place a bid on the interactive auction board at the sale room. Each buyer is given a unique number for identification (buyer number). All the buyer needs to do is enter their buyer number, the item number and their bid. Their bid must be greater than any existing bids.

At the end of the auction, the company checks all the items and marks those that have bids greater than the reserve as sold. Any items sold will incur a fee of 10% of the final bid to be paid to the auction company.

Write and test a program or programs for the auction company.

Your program or programs must include appropriate prompts for the entry of data, data must
        be validated on entry.
•      Error messages and other output need to be set out clearly and understandably.
•      All variables, constants and other identifiers must have meaningful names.

You will need to complete these three tasks. Each task must be fully tested.

Task 1 – Auction set up.
For every item in the auction the item number, description and the reserve price should be recorded. The number of bids is set to zero. There must be at least 10 items in the auction.

Task 2 – Buyer bids.
A buyer should be able to find an item and view the item number, description and the current highest bid. A buyer can then enter their buyer number and bid, which must be higher than any previously recorded bids. Every time a new bid is recorded the number of bids for that item is increased by one. Buyers can bid for an item many times and they can bid for many items.

Task 3 – At the end of the auction.
Using the results from TASK 2

1. How you Identified items that have reached their reserve price, mark them as sold
  if highestBid(count) > resPrice(count) then
    sold$(count) = "sold"
  end if

2. How you calculated and displayed 10% of the final bid as the auction company fee and 
        added this to the total fee for all sold items. 

    if highestBid(count) > resPrice(count) then
     sold$(count) = "sold"
      itemFee(count) = highestBid(count) * 10/100
     totalFee = totalFee + itemFee(count)
    end if

Display total fee of company. 

if highestBid(count) > resPrice(count) then
      itemFee(count) = highestBid(count) * 10/100
     totalFee = totalFee + itemFee(count)
 end if
        Print " Total Company Fee = ";totalFee

3. How did you find and displayed the item number & final bid for all the items with 
        bids that have not reached their reserve price. 

for count=1 to numOfItems
   if highestBid(count) < resPrice(count) then
    print itemNo(count), highestBid(count),numOfBids(count)
    belowResPrice = belowResPrice + 1
   end if
  next

4. How did you find and displayed the item number of any items that have received no bids. 

for count=1 to numOfItems
   if numOfBids(count)=0 then
    print itemNo(count), numOfBids(count)
   end if
 next

5. How did you Calculated/Display the number of items sold, the number of items that 
        did not meet the reserve price and the number of items with no bids.

for count = 1 to numOfItems
   if highestBid(count) > resPrice(count) then   
      tsold = tsold + 1
   if numOfBids(count) = 0                      then
      noBids = noBids + 1
   if highestBid(count) < resPrice(count) then
      belowResPrice = belowResPrice + 1
   print  "Total number of items sold                         = ";tsold
   print "Num of items that below the reserve price  = ";belowResPrice
   print "Num of items with no bids                           = ";noBids
next

'******************************** THIS IS TASK 1 ***************************'
 do
  input "Enter number of items in auction "; numOfItems
  if numOfItems < 3 then
    print "Auction cannot start with items less then 3 items. Please re-enter"
  end if
 loop until numOfItems >= 3

 dim itemNo(numOfItems)
 dim desc$(numOfItems)
 dim resPrice(numOfItems)
 dim numOfBids(numOfItems)
 dim highestBid(numOfItems)
 dim currentBuyer(numOfItems)

 check = 1
 count = 1

 while count <= numOfItems
  input "Enter item number      ";itemNo(count)

   while check < count
    if itemNo(count) = itemNo(check) then
      print "*** Duplicate ***"
      input "Enter item number      ";itemNo(count)
      check = 1
    else
      check = check + 1
    end if
   wend
   check=1

   input "Enter description     "; desc$(count)

  do
   input "Enter reserve price   "; resPrice(count)
    if resPrice(count) <= 0 then
      print "Invalid reserve price entered."
    end if
  loop until resPrice(count) > 0

   numOfBids(count) = 0
   highestBid(count)= 0
   count = count + 1
 wend

   print "---------------------------------------------------------"
   print " ItemNo      Description    Reserve-Price   Total-Bids   "
   print "---------------------------------------------------------"

  for count=1 to numOfItems
   print  itemNo(count),desc$(count),resPrice(count),numOfBids(count)
  next

'************************* THIS IS TASK 2 *************************************'

  input "Press enter to  ********* START AUCTIONS **********";tmp
  cls

  op$="n"
  while op$="n" or op$="N"

   input "Enter item number to search : ";ms

   loc=0

   for count=1 to numOfItems
    if ms=itemNo(count) then
     loc=count
    end if
   next

   if loc=0 then
    print "Not Found......"
   end if

   if loc>0 then
    print "itemNo   description    ReservePrice    HighestBid"
    print itemNo(loc),desc$(loc),resPrice(loc),highestBid(loc)

    input "Enter Buyer Code : "; bc

   do
    input "Enter you Bid    : "; bid
     if bid <= highestBid(loc) then
      print "Bid must be larger than current highest bid "
     end if
   loop until bid > highestBid(loc)

     if (bid>highestBid(loc)) then
      highestBid(loc)=bid
      currentBuyer(loc)=bc
      numOfBids(loc)=numOfBids(loc)+1
     end if

   end if

   input "Want to END auctions [y/n] : ";op$
   cls
   wend

   print "----------------------------------------------------------------------------------------------------------"
   print " itemNo      Description    Reserve-Price   Total-Bids   Highest-Bid   Current-Buyer"
   print "----------------------------------------------------------------------------------------------------------"

  for count=1 to numOfItems
   print  itemNo(count),desc$(count),resPrice(count),numOfBids(count),highestBid(count),currentBuyer(count)
  next

  input "Press enter to continue...........";a

 '******************************** This is Task 3 **********************************

dim sold$(numOfItems)
dim itemFee(numOfItems)
dim SoldItemFee(numOfItems)
totalFee = 0
tsold = 0
noBids = 0
belowResPrice = 0

 for count = 1 to numOfItems

   if highestBid(count) > resPrice(count) then
    sold$(count) = "sold"
    itemFee(count) = highestBid(count) * 10/100
    SoldItemFee(count)=highestBid(count)+itemFee(count)
    totalFee = totalFee + itemFee(count)
    tsold = tsold + 1
   end if


   if numOfBids(count) = 0 then
    noBids = noBids + 1
   end if
 next count

' Displaying items that did not recieved any bids.
  print
  print "Items that had no bids are :"

 for count = 1 to numOfItems
  if highestBid(count) = 0 then
    print itemNo(count)
  end if
 next count

   print "---------------------------------------------------------------------------------------------------------------"
   print " itemNo  Description   Reserve-Price   Total-Bids   Highest-Bid    Current-Buyer  Company Fee  FinalFee  Status   "
   print "---------------------------------------------------------------------------------------------------------------"

   for count=1 to numOfItems
    print  itemNo(count),desc$(count),resPrice(count),numOfBids(count),highestBid(count),currentBuyer(count),itemFee(count),SoldItemFee(count),sold$(count)
   next

   Print "*******************************"
   Print " Total Company Fee = ";totalFee
   Print "*******************************"

  print "Items that have not reached their reserve price (with their final bid) are "
  print "---------------------------------------------------------------------------"
  print " itemNo       Highest-Bid         Total Bids "
  print "---------------------------------------------------------------------------"
  for count=1 to numOfItems
   if highestBid(count) < resPrice(count) then
    print itemNo(count), highestBid(count),numOfBids(count)
    belowResPrice = belowResPrice + 1
   end if
  next

  input "Press enter to continue...........";a

  print "Items that have received no bid "
  print "--------------------------------"
  print " itemNo       Total Bids   "
  print "--------------------------------"
  for count=1 to numOfItems
   if numOfBids(count)=0 then
    print itemNo(count), numOfBids(count)
   end if
  next

 print
 print "Total number of items sold                                        = ";tsold
 print "Number of items that did not meet the reserve price = ";belowResPrice
 print "Number of items with no bids                                    = ";noBids
 print "Total auction company fee                                          = ";totalFee




Computer Systems (FAST TRACK)

1     Data representation   1.1    Number systems   How and why computers use binary to represent all forms of data? •     Any form ...