Introduction To Programming Test

This is an example of what you should be able to do at the Introduction to Programming level. If you are not able to do this exercise, you should do one of these courses:

If you are able to do this exercise, please do it in the programming language of your choice and email your source code to us, indicating what your course is that you apply for (for example the Coding Bootcamp)

TEST:

Use data structures (like arrays) to represent a shopping cart with 4 items. To represent this we need to initialise them to hold the items being sold:

The following is an example with primitive arrays, but you may use different (more modern) data structures to achieve the same goal. As long as the program produces the desired solution.

Array Names

Initial Values

Items
Descriptions
Prices
Quantities
Totals
[1,2,3,4]
[“Coke”,”Kit Kat”, “Bar One”, “Fanta”]
[7.5, 9.5, 8.5, 7.5]
[0. 0. 0. 0]
[0.0,0,0,0.0,0.0]

 

  • Let the user select some items (1 – 4) and if a selection is already in the array, then increment the corresponding quantity by 1.
  • Re-display the shopping cart after every selection (until next notes), showing the updated quantity and line total.
  • If the user selects an item number (5 or more) which is not in the shopping cart, then nothing is done – at this stage we only want to work with the initial 4 items.
  • If the user enters 99 – then the program quits and prints out the contents of the shopping cart as such:

Item

Description

Price

Quantity

Total

1
2
3
4
Coke
Kit Kat
Bar One
Fanta
R7.50
R9.50
R8.50
R7.50
1
4
2
1
R7.50
R38.00
R17.00
R7.50

 

Grand Total : R70.00

This program tests to see that you are familiar with, and are able to solve problems with arrays, loops, and flow control.

Print Friendly, PDF & Email

Comments

  1. Thanyani Rotshidzwa

    Iam interested to be part of the program

    2018-11-20
  2. Masana

    I’d like to know more about this course

    2019-07-27
    • Arnold

      It is your entry point into any one of our Coding Bootcamps

      2019-07-30
  3. Nokulunga Nkabinde

    Can I get more Information, I’m keen on making this a career.

    2019-11-20
    • Arnold

      Hi,

      Intro To Programming.
      Coding Bootcamp codecollege.co.za/coding-bootcamp

      can you please send your phone number so we can chat?

      2019-11-22
  4. Themba

    I would like to study attend the course

    2019-12-12
    • Arnold

      HI,

      Sure you are welcome. Please go to the bookings menu and regsiter for the course

      2019-12-26
  5. Sandile Chitsa

    I already have experience with programming so I don’t believe I need this test. I would like to go straight to the introduction to programming test ,so how would I do that?

    2019-12-24
    • Arnold

      Hi,

      Please do the above test in programming language of your choice and submit the source code to us.

      2019-12-26

Leave a Reply

Your email address will not be published. Required fields are marked *