Photo AI

An applicant must complete an application form to obtain a loyalty card - NSC Information Technology - Question 1 - 2017 - Paper 1

Question icon

Question 1

An-applicant-must-complete-an-application-form-to-obtain-a-loyalty-card-NSC Information Technology-Question 1-2017-Paper 1.png

An applicant must complete an application form to obtain a loyalty card. Do the following: - Compile and execute the program found in the Question1 folder. The use... show full transcript

Worked Solution & Example Answer:An applicant must complete an application form to obtain a loyalty card - NSC Information Technology - Question 1 - 2017 - Paper 1

Step 1

Button [Question 1_1]

96%

114 rated

Answer

To validate the information entered by the user, begin by extracting the name and surname from the input text box. Check for the presence of at least one space to determine if multiple names are included. If no space is found, a dialog box should display the message:

"The name-surname field does not contain a space."

Next, extract the ID number. If it is empty, display the message:

"An ID number must be entered."

If the ID number is entered but does not meet the requirement of 13 digits, display the message:

"The ID number does not consist of 13 digits."

If both fields are valid, update the visibility of the welcoming message label to reflect this with the message:

"Welcome to our loyalty card program!"

Step 2

Buttons with Icons showing type of Loyalty card

99%

104 rated

Answer

In this section, the user is required to enter the final amount of their purchase. The program should extract this amount from the text box and convert it into a real value (number) for processing.

Utilize conditional statements (Case/Switch or If) to check the type of loyalty card selected. If the card is of type DI (Immediate Discount), compute the discount by calculating 1.5% of the entered amount:

extDiscount=0.015imesextAmount ext{Discount} = 0.015 imes ext{Amount}

This calculated discount needs to be displayed as currency with two decimal places.

If the card is of type CH (Donation towards charity), calculate the amount to be donated:

  1. Calculate the number of R100's in the purchase amount.
  2. Multiply this by R3 to get the total donation amount. Provide a confirmation message that includes the calculated benefit.

Step 3

Button [Question 1_4]

96%

101 rated

Answer

The completion of the loyalty card number requires compiling several parts. Start with Part 1, which is comprised of:

  • The letter 'B' if the business type is chosen, followed by the first three digits of the ID number.

For Part 2, access the last digit of the ID number and concatenate it with the appropriate character from the predefined string charString that corresponds to that last digit's value.

Lastly, Part 3 must reflect the loyalty card type determined earlier (DI or CH) in the respective section. Combine these components to form a complete loyalty card number that adheres to the specified format.

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

;