2019 A Level

From TRCCompSci - AQA Computer Science
Jump to: navigation, search

Write a program that gets two words from the user and then displays a message saying if the first word can be created using the letters from the second word or not.

For example:

  • The word EAT can be formed from the word ATE as the first word uses one E, one A and one T and the second word also contains one of each of these letters.
  • The word EAT can be formed from the word HEART as the second word contains one E, one A and one T which are the letters needed to form the first word.
  • The word TO can be formed from the word POSITION as the second word contains one T and (at least) one O which are the letters needed to form the first word.
  • The word MEET cannot be formed from the word MEAT as the second word only contains one E and two Es are needed to form the first word.

You may assume that the user will only enter words that consist of upper case letters.

Evidence that you need to provide Include the following evidence in your Electronic Answer Document.

  1. Your PROGRAM SOURCE CODE.
  2. SCREEN CAPTURE(S) showing the result of testing the program by entering:
    1. the word NINE followed by the word ELEPHANTINE.
    2. the word NINE followed by the word ELEPHANT.