A two-dimensional (2D) array Account[] contains account holders' names and passwords for a banking program. A 2D array AccDetails[] has three columns containing the following details: • column one stores the balance – the amount of money in the account, for example 250.00 • column two stores the overdraft limit - the maximum total amount an account holder can borrow from the bank after the account balance reaches 0.00, for example 100.00 • column three stores the withdrawal limit – the amount of money that can be withdrawn at one time, for example 200.00 The amount of money in a bank account can be negative (overdrawn) but not by more than the overdraft limit. For example, an account with an overdraft limit of 100.00 must have a balance that is greater than or equal to -100.00 Suitable error messages must be displayed if a withdrawal cannot take place, for example if the overdraft limit or the size of withdrawal is exceeded. The bank account ID gives the index of each account holder's data held in the two arrays. For example, account ID 20's details would be held in: Account[20,1] and Account[20,2] AccDetails[20,1] AccDetails[20,2] and AccDetails[20,3] The variable Size contains the number of accounts. The arrays and variable Size have already been set up and the data stored. Write a program that meets the following requirements: • checks the account ID exists and the name and password entered by the account holder match the name and password stored in Account[] before any action can take place • displays a menu showing the four actions available for the account holder to choose from: 1. display balance 2. withdraw money 3. deposit money 4. exit • allows an action to be chosen and completed. Each action is completed by a procedure with a parameter of the account ID. You must use pseudocode or program code and add comments to explain how your code works. All inputs and outputs must contain suitable messages. You only need to declare any local arrays and local variables that you use. You do not need to declare and initialise the data in the global arrays Account[] and AccDetails[] and the variable Size
- A two-dimensional (2D) array Account[] contains account holders' names and passwords for a banking program. A 2D array AccDetails[] has three columns containing the following details: • column one stores the balance – the amount of money in the account, for example 250.00 • column two stores the overdraft limit - the maximum total amount an account holder can borrow from the bank after the account balance reaches 0.00, for example 100.00 • column three stores the withdrawal limit – the amount of money that can be withdrawn at one time, for example 200.00 The amount of money in a bank account can be negative (overdrawn) but not by more than the overdraft limit. For example, an account with an overdraft limit of 100.00 must have a balance that is greater than or equal to -100.00 Suitable error messages must be displayed if a withdrawal cannot take place, for example if the overdraft limit or the size of withdrawal is exceeded. The bank account ID gives the index of each account holder's data held in the two arrays. For example, account ID 20's details would be held in: Account[20,1] and Account[20,2] AccDetails[20,1] AccDetails[20,2] and AccDetails[20,3] The variable Size contains the number of accounts. The arrays and variable Size have already been set up and the data stored. Write a program that meets the following requirements: • checks the account ID exists and the name and password entered by the account holder match the name and password stored in Account[] before any action can take place • displays a menu showing the four actions available for the account holder to choose from: 1. display balance 2. withdraw money 3. deposit money 4. exit • allows an action to be chosen and completed. Each action is completed by a procedure with a parameter of the account ID. You must use pseudocode or program code and add comments to explain how your code works. All inputs and outputs must contain suitable messages. You only need to declare any local arrays and local variables that you use. You do not need to declare and initialise the data in the global arrays Account[] and AccDetails[] and the variable Size[15]
Mark scheme
Marking points from the official mark scheme (May/June 2023). The mark or mark type is shown in brackets.
- [15] Read the whole answer: Check if each requirement listed below has been met. Requirements may be met using a suitable built-in function from the programming language used (Python, VB.NET or Java) Mark SEEN on script if requirement met, cross if no attempt seen, NE if partially met (see marked scripts). Use the tables for A02 and A03 below to award a mark in a suitable band using a best fit approach Then add up the total. Marks are available for: • AO2 (maximum 9 marks) • AO3 (maximum 6 marks) Data Structures required names shown underlined must be used as given in the scenario Arrays or lists Account, AccDetails Variable Size, AccountNumber Requirements (techniques) R1 Check account number and password (iteration and validation, selection, input, output) R2 Display menu and make a selection (output, input and selection) R3 Perform actions selected (use of arrays and procedures with parameters) Example 15 mark answer in pseudocode // Procedures to be called PROCEDURE CheckDetails (AccID : INTEGER) DECLARE Name, Password : STRING // local variables Valid ← FALSE IF AccID <0 OR AccID > Size THEN OUTPUT "Invalid Account Number" ELSE OUTPUT "Please Enter Name " INPUT Name OUTPUT "Please Enter Password " INPUT Password IF Name <> Account[AccID,1] OR Password <> Account[AccID,2] THEN OUTPUT "Invalid name or password" ELSE Valid ← True ENDIF ENDIF ENDPROCEDURE PROCEDURE Balance (AccID : INTEGER) OUTPUT "Your balance is ", AccDetails[AccID,1] ENDPROCEDURE PROCEDURE WithDrawal (AccID : INTEGER) DECLARE Amount : REAL // local variable REPEAT OUTPUT "Please enter amount to withdraw " INPUT Amount IF Amount > AccDetails[AccID,3] THEN OUTPUT "Amount greater than withdrawal limit" ENDIF IF Amount > AccDetails[AccID,2] + AccDetails[AccID,1] THEN OUTPUT "Amount greater than cash available" ENDIF IF Amount <= AccDetails[AccID,3] AND Amount < AccDetails[AccID,2] + AccDetails[AccID,1] THEN AccDetails[AccID,1] ← AccDetails[AccID,1] - Amount ENDIF UNTIL Amount<= AccDetails[AccID,3] AND Amount > AccDetails[AccID,2] + AccDetails[AccID,1] AND Amount > 0 ENDPROCEDURE PROCEDURE Deposit (AccID : INTEGER) DECLARE Amount : REAL // local variable REPEAT OUTPUT "Please enter a positive amount to deposit " INPUT Amount UNTIL Amount >0 AccDetails[AccID,1] ← AccDetails[AccID,1] + Amount ENDPROCEDURE // Declarations of global variables for information not required in candidate responses DECLARE AccountNumber, Choice : INTEGER DECLARE Valid, Exit : BOOLEAN OUTPUT "Please enter your account number " INPUT AccountNumber CheckDetails (AccountNumber) IF Valid THEN REPEAT OUTPUT "Menu" OUTPUT "1. display balance" OUTPUT "2. withdraw money" OUTPUT "3. deposit money" OUTPUT "4. exit" OUTPUT "please choose 1, 2, 3 or 4" INPUT Choice CASE OF Choice 1 : Balance (AccountNumber) 2 : Withdrawal (AccountNumber) 3 : Deposit (AccountNumber) 4 : Exit ← TRUE OTHERWISE OUTPUT "Invalid choice" ENDCASE UNTIL Choice = 4 ELSE OUTPUT "Invalid account number " ENDIF
- [AO2] AO2: Apply knowledge and understanding of the principles and concepts of computer science to a given context, including the analysis and design of computational or programming problems 0 No creditable response. 1-3 At least one programming technique has been used. Any use of selection, iteration, counting, totalling, input and output. Some data has been stored but not appropriately. Any use of variables or arrays or other language dependent data structures e.g. Python lists. 4-6 Some programming techniques used are appropriate to the problem. More than one technique seen applied to the scenario, check the list of techniques needed. Some of the data structures chosen are appropriate and store some of the data required. More than one data structure used to store data required by the scenario. 7-9 The range of programming techniques used is appropriate to the problem. All criteria stated for the scenario have been covered by the use of appropriate programming techniques, check the list of techniques needed. The data structures chosen are appropriate and store all the data required. The data structures used store all the data required by the scenario.
- [AO3] AO3: Provide solutions to problems by: • evaluating computer systems • making reasoned judgements • presenting conclusions 0 No creditable response. 1-2 Program seen without relevant comments. Some identifier names used are appropriate. Some of the data structures used have meaningful names. The solution is illogical. The solution is inaccurate in many places. Solution contains few lines of code with errors that attempt to perform a task given in the scenario. The solution attempts at least one of the requirements. Solution contains lines of code that attempt at least one task given in the scenario. 3-4 Program seen with some relevant comment(s). The majority of identifiers used are appropriately named. Most of the data structures used have meaningful names. The solution contains parts that may be illogical. The solution contains parts that are inaccurate. Solution contains lines of code with some errors that logically perform tasks given in the scenario. Ignore minor syntax errors. The solution meets most of the requirements. Solution contains lines of code that perform most tasks given in the scenario. 5-6 The program has been fully commented. Suitable identifiers with names meaningful to their purpose have been used throughout. All of the data structures used have meaningful names. The program is in a logical order. The solution is accurate. Solution logically performs all the tasks given in the scenario. Ignore minor syntax errors. The solution meets all the requirements given in the question. Solution performs all the tasks given in the scenario.
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →