Question Constellation Sign up for free
Q07.0 4 marks

AQA · GCSE · Computer Science · Higher · Paper 1A Computational thinking and programming skills (C#)

A shop owner wants to create stock codes for each type of sweet they sell. Figure 5 shows some of the sweets.

Figure 5
sweetIDsweetNamebrand
S1WINE GUMSMAYNARDS
S2COLA CUBESBERRYMANS
S3STARBURSTWRIGLEY
  • A stock code is made up of the sweetID.
  • It then uses the first letter and the second letter in sweetName.
  • It then uses the first letter of the brand.

For example, the stock code for WINE GUMS would be S1WIM, and the stock code for STARBURST would be S3STW.

Write a C# program to create the stock code for a sweet. The program should get the user to enter the sweetID, sweetName and brand; create the stock code; and assign the stock code to a variable called code. Use meaningful variable name(s) and C# syntax.

Your answer