Photo AI

You are organising a small LAN event - NSC Information Technology - Question 5 - 2017 - Paper 2

Question icon

Question 5

You-are-organising-a-small-LAN-event-NSC Information Technology-Question 5-2017-Paper 2.png

You are organising a small LAN event. The participants will have to complete a registration form. The information will be used to keep track of their results as well... show full transcript

Worked Solution & Example Answer:You are organising a small LAN event - NSC Information Technology - Question 5 - 2017 - Paper 2

Step 1

5.1 Write an algorithm to create the access code.

96%

114 rated

Answer

  1. Get the name and surname.
  2. Initialise a blank string for the access code.
  3. Get the length of the name and surname combined.
  4. Loop through each character in the combined string.
  5. If the character is a vowel (a, e, i, o, u) or a space, skip it; otherwise, add it to the access code string.
  6. Change the first and last character of the access code to uppercase.
  7. Append a '#' at the end of the access code.

Step 2

5.2.1 What does the ':' indicate?

99%

104 rated

Answer

The ':' indicates that the attributes are private fields.

Step 3

5.2.2 What is the difference between a mutator and accessor method? Give an example of each making use of objLAN.

96%

101 rated

Answer

Accessor methods are used to return the contents of an object's fields, such as getTeamName, getGender, and getDOB. Mutator methods are used to change the contents of an object's fields, for example, calculateCost.

Step 4

5.2.3 What is the purpose of a constructor?

98%

120 rated

Answer

A constructor instantiates the object and initializes the fields of the object.

Step 5

5.2.4 What is the purpose of a toString method?

97%

117 rated

Answer

The toString method compiles the object's attributes into a single string variable.

Step 6

5.3 Draw a trace table with the following headings:

97%

121 rated

Answer

To complete the trace table, the following values will be calculated based on the input values provided:

EngineCountNumberSizeAverageOUTPUT
1.8011.80.00
2.0122.01.00
1.0231.02.00
1.3241.32.00
1.0351.01.00
2.5362.51.00
2.0472.01.50
1.3481.31.50
1.8591.81.50
1.35101.31.50
-1510-10.50

Join the NSC students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

;