5Medium
0/4

A garden center wants to create unique stock codes for the plants they sell.

Table 1 shows some example plant details.

plantIDplantNamesupplier
P1LAVENDERGREENGLOW
P2MARIGOLDBLOOMTIME
P3BEGONIASUNGROW

A stock code is made up of the:

  • plantID
  • first letter and the third letter of the plantName
  • first letter of the supplier

For example:

  • The stock code for LAVENDER would be P1LVG
  • The stock code for MARIGOLD would be P2MRB

Write a C# program to create this stock code.

The program should:

  • Get the user input for plantID, plantName and supplier
  • Create the correct stock code
  • Assign the stock code to a variable called code

You should use meaningful variable name(s) and C# syntax in your answer.

[4]

String handling operations in a programming language Questions

Practise AQA GCSE Computer Science String handling operations in a programming language with exam-style questions for GCSE Computer Science. 90 questions, matched to the AQA GCSE Computer Science (8525) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.

PreviousNext

String handling operations in a programming language Questions

  1. GCSE
  2. /Computer Science
  3. /String handling operations in a programming language