Cbank is a programming language developed in the year 2018 which is primarily an extension of the popular C++ language. The language syntax is customized to be used in banking application of the modern world. The challenges with the generic C++ language such as being a slightly above low level portray complexity, especially to novice users. The developer of the Cbank language is ambitious in the sense that the new improvement is aimed to bridge the gap between low level to almost close to the natural human language. It uses a programming paradigm often used in the modern programming language referred to as object-oriented paradigm. Inbuilt library functions provide users with a platform in order to major on functional requirements rather than the skills in the syntax. Windows and UNIX platforms are compatible with the language. This documentation focuses on providing the concepts and illustrations to both beginners and experienced programmers learning Cbank language for the purpose of developing banking systems.
By the look of the above code snippet, the following components are discussed below:
All whitespaces are not executed by the compiler except one whitespace in Cbank language known as a newline character. The line of code is terminated by insertion of a newline character in contrast with many languages which use a semicolon to mark the end. Since this new language is aimed to improve programming in banking applications, developers won’t take more time figuring out where to terminate the line of code, thus focusing more on the functionality of the output program. The compiler will identify the two new lines as separate lines of code executed independently.
The simple program in the illustration above is not sufficient to compute a useful function that a program should do. This fact paves a room for the use of variables, storage memory locations that can be easily manipulated by the user. To begin with, the identifiers of variables comprises of:
The identifier can be any combination of characters however it should not conflict with the predefined Cbank language keywords. For example; debit_amount, credit_amount, customerID, Accountnumber1, 2branch e.t.c. In contrast with C++ which strictly rejects special characters at the beginning of the identifier except for the underscore, this language accomplishes the gap.
Some examples of keywords to avoid when naming identifiers include: display, positive_integer, universal_integer, decimal, get_input, date, print and others discussed later.
The type of data stored in the computer memory is defined by the appropriate data type keyword. In comparison with common languages like C++, they tend to use int, float, char etc. as data type definition, this language uses extended data types suitable for use in baking systems:
In the Cbank language, it is strongly typed hence all variables should be declared prior to their usage. Variables are declared anywhere in the program provided they are within the desired scope. It is also possible to declare and initialize a variable at the same time (Ellis & Stroustrup, 1990). This concept allows memory reservation for a particular value during the process of compiling and actual execution. Example of a sample code with an illustration of declaration and initialization of variables. Working with undeclared variables will result in both syntax and semantic error. Below is a sample code that illustrates the variables and their scope.
#include<basicbankingfunctions> positive_integer account_number NB Variable declaration ENDNB Startmain account_number=80003441 NB Variable initialization ENDNB decimal interest_accumulated=707.34 NB Declaration and initialization ENDNB display (“Top current debtor details”) display (“Account number: “. account_number) display (“Interest Accumulated:”. interest_accumulated) Endmain |
When compiled and executed the above program will give the following output:
However, it should be noted that variable is usable in the scope where it was declared. Just like any structural language as well as object-oriented language, variable declared in the scope of a function cannot be used by other functions. The existence of universal variables is also available in the sense that they are declared outside any given function. Borrowing some concepts of variables in C++ programming, in the above sample code: “positive_integer account_number “is a universal variable since it is not inside a function; “decimal interest_accumulated” is a variable that can only be accessed within the Startmain and Endmain scope.
Constants comprise of variables that cannot be modified further once initialized. Due to their capability of maintaining integrity, they can be defined anywhere in any scope of the program; either inside or outside a function. For developers of banking systems, this concept is applicable in areas where figures remain fixed such as month duration for maturity in lock savings accounts (Musser et al., 2009). For example, many banks specify this duration to be twelve months’ constant figure. The definition and initialization of a constant variable consist of the keyword constant, followed by the data type and finally the actual value. It is as shown below:
Banking systems requires to performing mathematical operations just like any other information system. Cbank have inbuilt operators to facilitate both arithmetics as well as logical operations (Gupta et al., 2003). Concepts of operators are derived from the C++ language and are similar to Cbank language. Suppose there are two variables namely; interest_one=20 and interest_two=10
Operation |
Output |
Explanation |
* |
interest_one* interest_two = 200 |
It multiplies the two variables |
/ |
interest_one/interest_two = 2 |
Gives the quotient |
+ |
interest_one +interest_two = 30 |
Sums up the variables |
– |
interest_one -interest_two=10 |
Gets the difference |
mod |
7 mod 2 = 1 |
Gives the remainder of the quotient |
increment |
interest_one increment =21 |
Adds the given variable by 1 |
decrement |
interest_one decrement = 19 |
Subtracts the given variable by 1 |
equal |
interest_one equal interest_two=false |
Evaluates the equality of the variables, in case they match it outputs true else false |
not_equal |
interest_one not_equal interest_two=true |
Evaluates the equality of the variables, in case they match it outputs false else true |
greater_than |
interest_one greater_than interest_two=true |
If the first variable is greater than the second, it is true else false |
lesser_than |
interest_one lesser_than interest_two=false |
If the first variable is lesser than the second, it is true else false |
greater_equal |
interest_one greater_equal interest_two=true |
If the first variable is greater than or equivalent to second, it is true else false |
lesser_equal |
interest_one lesser_equal interest_two=false |
If the first variable is lesser than or equivalent to second, it is true else false |
AND |
1 AND 0 = 0 |
Logical AND operation |
NOT |
NOT 1= 0 |
Logical NOT operation |
OR |
1 OR O =1 |
Logical OR operation |
= |
positive_integer = 97 |
Assignment of value to a variable |
Based on the given conditions and parameters it is possible for a programmer to instruct the path of execution of the code. It is explicitly programmed indicating the execution when a certain condition is met or in case if it is not met. Most programming paradigms abstract the control structure complexity by means of a flowchart diagram. Since the Cbank language is an extension of C++ language, the same conditional statements used there apply to the new language because experience system developers are familiar with them. The following is a simple code sample illustrating the control structures.
In the above program, the message “Request for loan security” is displayed to the user since it has met the if condition statement that is the value is greater than 50000. Otherwise, “Grant loan to the debtor” message is skipped because it has a result of false that is failed to achieve the requirement of the if statement. Suitable for banking systems for checking qualifications of loans to customers.
Loops are necessary for situations where the program is expected to execute a section of code repeatedly. A branch manager may be interested to list all customers with balances greater than a certain amount, programmatically this is only possible when the execution traverses the entire table containing the balance of customers in the database. The developer will therefore not write if statement for every customer but do it explicitly in a loop statement. Cbank language uses repeat_if () keyword to deal with loops. It is just like an inbuilt function where the condition of the loop is passed as a parameter.
Example code:
positive_integer number_of_customer=1 positive_integer number_of_customer_balance_above_average repeat_if (number_of_customer<1000) NB loop statement ENDNB { if(balance>10000) NB Conditional statement ENDNB { number_of_customer_balance_above_average increment } number_of_customer increment } |
The above loop statement functions well with varying values stored in the variable, however, sometimes the programmer is exactly sure of the number of times he or she want to loop a line of code. The keyword, repeat_times(), is used to loop a certain number of times and this figure is passed as a parameter. It is also referred to as a “fixed” loop in Cbank. For example, if you need to display 20 lines on the screen, the following can be done:
repeat_times(10) NB Repeatedly executes the block of code 10 times ENDNB { display (“_________________”) NB prints a line on the screen ENDNB } |
In Cbank language only the built-in futures are applicable, unlike other languages where the user defines the name, return type and operations of a function. The language is customized to perform only operations commonly used in banking systems thus built-in functions are sufficient. However, the developer is required to recall or refer to the manual about the function names and their logical outputs. Such built-in functions include:
deposit (a, b): feature used to add “a” to the balance of the customer with account number “b”
withdraw (a, b): feature used to deduct a total amount “a” from the balance of customer with account number “b”
deactivate(a): feature to suspend account number “a”
reactivate(a): feature used to reinstate a suspended account number
interest (a, b, c): feature used to compute the interest given principal amount “a”, percentage rate “b” and duration “c”
transfer(a,b,c): used to send “a” amount of funds from account number “b” to account number “c”
payloan(a,b): used to pay a loan with “a” owed by account number “b”
balance_query(a): returns the bank balance of account number “a”
These inbuilt functions are however callable inside the main function, an example shown below.
#include<basicbankingfunctions> Startmain decimal cash=2200.00 positive_integer account_number1=31398744 positive_integer account_number2=32010078 display (balance_query (account_number1)) NB display the balance ENDND deposit (cash, account_number) NB add the 2200.00 to the current balance ENDND transfer (200.00, account_number1, account_number2) NB transfer 200.00 ENDND display (balance_query(account_number1)) NB display the current balance ENDND payloan (1000.00, account_number1) NB pay loan, deduct 1000 ENDND display (balance_query(account_number1)) NB display the current balance ENDND Endmain |
0.00 2000.00 1000.00 |
There arises a need for storage of several items with the similar data types, the individual declaration is not only tedious but also can result in inaccuracy. Instead of declaring account_number1, account_number2……account_number100, it is recommended to use an array which requires only a single declaration and facilities access to data items by the use of indexes. The memory storage for arrays has consecutive and sequential addresses. The first addresses hold the preceding data items while the last address holds the succeeding data items. Just like the other data types, the array should be declared before they are used. This concept is an extension of the C++ language which paved way for easier definitions of arrays. In banking systems, the program might decide to store all account numbers of customers before performing processing, hence the arrays are useful in this case (Stroustrup, 2000).
Declaring arrays in Cbank follows the following format – datatype name_of_array size
Initialization requires that you assign data items to the array name declared while separating with commas – name_of_array = item1, item2, item3, item4……, itemSIZE.
Accessing the elements contained in the given array is possible by indicating the index of the element needed besides the array name. name_of_array at 5
Example of a program code showing the usage of arrays in Cbank:
#include<basicbankingfunctions> Startmain positive_integer account_numbers 5 account_numbers = 48430, 34285, 34912, 45213, 45219 display (“Account number at fourth position: “. account_number at 4) positive_integer counter = 1 display (“Showing the list of all account numbers of stakeholders”) positive_integer counter = 1 repeat_times (5) NB loop statement repeating the execution of the block 5 times ENDNB { display (“.”. counter.”. “. account_number at counter) counter increment NB increment counter for purpose of shifting to the next index ENDNB } Endmain |
The final output of the program:
Account number at fourth position: 45213 Showing the list of all account numbers of stakeholders 1. 48430 2. 34285 3. 34912 4. 45213 5. 45219 |
The above program also utilizes the loop statement defined earlier in order to access and display the elements in the array. Cbank arrays can be of any data types such as universal_integer, bool, phrase, and decimal. Furthermore, both logical and mathematical operations can be easily performed in arrays provided they have compatible data types. For example, in the multiplication operation, only compatible datatypes such as integers against integers can be multiplied: multiplication of phrase arrays with integers will result in a syntax error since it they aren’t compatible. This language also offers functionalities for multi-dimensional arrays which can comprise of 2D and 3D arrays for the purposes of working with complex banking computations.
The data bytes can stream from input devices to the program’s memory and on the other hand, it can stream from memory to output devices like printer or monitor. Cbank provides libraries to handle both outputs and inputs. The header file #include<basicbankingfunctions> has definitions for:
display – basic output used for showing specified data items to the user’s screen. The default monitor shows the output, can be a normal monitor or ATM machine display.
get_input – used to get data from the user using a keyboard. It takes a bit stream of the keystrokes until the user presses enter key where it saves to the memory allocated.
show_error – error notifications to the users. The error message can both customizable by the developer or a default error message in case no description defined.
display_format – used to describe the output format displayed on the screen, such as table format for bank statements, list format for transaction list and graphical format for purposes of decision making by stakeholders.
print – Sends a printing job to the default printer which outputs a hardcopy. Useful in banking systems since customers require printed receipts kept for future reference and evidence.
print_file – used to write data to a file especially a basic file stored permanently in a given location until an explicit code to modify or delete the file.
read_file – used to read data from a specified file into program’s memory. Bank information stored in files can be retrieved this function for input from files.
send_mail – used to send an email notification to a specified address together mail contents.
The following examples show some of the input and output function usages:
#include<basicbankingfunctions> Startmain phrase customer_name = “James Bond” decimal loan_balance = 800.00 decimal instalments=0.00 display (“Enter the amount paid by”. customer_name); get_input> installments NB getting the user input ENDNB if (instalments lesser_than 0) { show_error (“check your input and try again”) NB error notification on the screen ENDNB } else { loan_balance = loan_balance – installments NB mathematical operation ENDNB display_format (tab spaced, customer_name, loan_balance) print (customer_name. “___ “. loan_balance) print_file (debtorsfile.txt, customer_name. “___ “. loan_balance) } Endmain |
When the user of the above program enters a value less than 0, it will display an error message, otherwise assuming the user enters 200 then the following happens: Loan balance is reduced by the amount of installment collected. This involves a mathematical operation by subtracting two variables and the result is assigned to one variable as shown above. The screen will display customer name and loan balance separated by a tab space, in this case, “James Bond 600”
The default printer will produce a receipt containing “James Bond 600”. A file named “debtorfile.txt” will have the information appended to it. The text file is stored in the secondary memory of the computing device running the program.
Pointers are most frequently used in the dynamic allocation of memory. Just like in the other languages, they act as a storage for memory addresses for other variables. Each and every variable has its specific address, the address can be retrieved by the use of the keyword get_address followed by a variable name. Suppose you have the following sample code:
#include<basicbankingfunctions> Startmain decimal balance positive_integer account_numbers 9 display (“The address of decimal variable balance is: “) display (get_address balance) display (“The address of array variable is: “) display (get_address account_numbers) Endmain |
The output of the above sample code when executed will be as follows:
The address of decimal variable balance is: 0fe5xbb6bd The address of array variable is: 0febdxb05c |
A pointer is similar to a normal variable such that they should be declared before they are used. Pointer declaration format: datatype pointer pointer_name.
However, the datatype does not necessarily imply that the address is of that type but it illustrates the datatype of the memory location pointed. It is of great importance to use pointers in baking systems for the use of ever-changing foreign exchange rates. The below sample code illustrates the pointer definition and declaration.
#include<basicbankingfunctions> Startmain decimal balance=100.00 NB variable declaration and assignment ENDNB decimal pointer id NB pointer declaration ENDNB id = get_address balance NB variable declaration and assignment ENDNB display(id) NB displays the memory address of variable balance ENDNB Endmain |
As seen earlier, arrays store several data items of the same data type such as an array of the account number, however, there is need to hold items of different data types. In Cbank they are known as record giving the developer capability of combining different data types. For example, the banking system needs to store personal information about customers. Customer records consist of different attributes are possible for each record such as name, date of birth, telephone number, national ID number, physical address and email. A record should have a definition of their usage, the following is a format for defining a record:
The definition is done outside the main function for purposes of making the records accessible globally. This concept is derived from C++ language which apply the same semantics for structures. Following is an illustration of accessing records:
#include<basicbankingfunctions> record customer NB record definition outside main function ENDNB { positive_integer customerID phrase first_name phrase last_name date date_of_birth positive_integer telephone } Startmain record customer customer1 NB record declaration ENDNB record customer customer2 copy_record (customer1. customerID, 345) NB record attributes assignment ENDNB copy_record (customer1. first_name, “Julius”) copy_record (customer1. last_name, “Mcee”) copy_record (customer1. date_of_birth, 6-12-2000) copy_record (customer1. telephone, 341550000) display (customer1. customerID) display (customer1. first_name) display (customer1. last_name) display (customer1. date_of_birth) display (customer1. telephone) Endmain |
The compiled and later executed code will give the following output:
345 Julius Mcee 6-12-2000 341550000 |
High-level languages often apply the concept of objects and classes. The paradigm enables data and functions to be defined, stored and retrieved from one package called class. Blueprints for a class included in its definitions with a method and variable declarations. The format for defining the class comprises of start_class class_name end_class.
For example:
start_class Loan_repayments
decimal interest
positive_integer duration
decimal instalments
end_class
The above is a class blueprint for loan repayments, however, the class variables are set to private by default unless an explicit definition is done. The accessibility of variables can be controlled by the use of access modifiers keywords which comprises of: private and public.
The modifier is put before the datatype keyword, for example, private decimal interest or public decimal installments.
After class definition outside the main function block, the objects of a class are called inside the main function. In order to use objects, they should be defined in this format.
Loan_repayments customer1
Loan_repayments customer2
In this illustration, objects customer1 and customer2 retain the data members in each. Thereafter, the members of the class are accessed via objects by the use of “access” keyword. An example code showing class definition, object declaration and data access in Cbank.
#include<basicbankingfunctions>
start_class Loan_repayments NB class definition ENDNB private decimal principal private decimal rate private positive_integer duration end_class Startmain Loan_repayments customer1 NB objects declarations ENDNB Loan_repayments customer2 decimal interest_accumulated 2 =0.0,0.0 customer1 access principal=40000.00 NB objects specifications ENDNB customer1 access rate=0.25 customer1 access duration=2 customer2 access principal=10000.00 customer2 access rate=0.10 customer2 access duration=4 NB Interest computations for customer 1 ENDNB interest_accumulated at 1= customer1 access principal * customer1 access rate * customer1 access duration display (“Interested accumulated for customer1: “. interest_accumulated at 1) NB Interest computation for customer 2 ENDNB interest_accumulated at 2= customer2 access principal * customer2 access rate * customer2 access duration display (“Interested accumulated for customer2: “. interest_accumulated at 2) Endmain |
The output of the code written above:
Interested accumulated for customer1: 20000.00 Interested accumulated for customer2: 4000.00 |
Inheritance is useful in object-oriented paradigm due to the capability of code reuse from other classes. Inheritance facilitates the quick and easy development of applications especially in the field of banking where demand for system module requires fast delivery. During the construction of a new class, the developer can borrow data members and methods from existing classes. The class whose characteristics are to be borrowed is called the parent class and the other referred to a child class. Many classes can have derivation in order to make a single customized class, inheritance, therefore, can be from one class or many classes and vice versa. In C++ language, the concepts of class inheritance also apply; base class and the derived class. Access control in inherited classes is explicitly defined by the programmer. Following is a sample Cbank program code illustrating the concept of class inheritance:
#include<basicbankingfunctions> start_class Employee NB This is the parent class ENDNB public phrase name public decimal salary function salary (salary) return salary end_function end_class
start_class Branch_manager: public Employee NB This is the child class ENDNB salary=60000.00 end_class Startmain Employee pay Branch_manager manager NB assignment of variables between the parent and child class ENDNB pay access salary = manager access salary NB Print the salary to the user’s screen ENDNB display (“Salary for branch manager is: “. pay access salary) Endmain |
Output
Salary for branch manager is: 60000.00 |
An unexpected error can occur during a program execution. In Cbank, an attempt of an operation to divide an integer by zero or divide a phrase by an integer both can result in an error. In such situations, a function is needed so as to shift control to other section of the program code in order to make it halt successfully. The keywords attempt, solve and notify are used in dealing with errors.
attempt – consists of a block of code that is likely to produce errors.
solve – the section where the control is directed after failure in the “attempt” block.
notify – used to generate an error notification in an exception occurrence condition
Conclusion
The new Cbank programming language designed particularly for developers working with banking systems. Since it is an extension the popular C++ language, it has additional built-in functions to facilitate quick and easy design, development and maintaining of banking information systems. This reference guide certainly is useful to both beginners and advanced programmers in object-oriented programming languages. The language features provide an insight for code reuse which aids fast delivery of software product as well as act as a medium of communication between system developers. Header files for basic banking functions are explicitly customized for banking systems in contrast with generic languages which comprises of vague and complex library functions. This form of customization motivates the users of the language because it is a high-level language comprises of human-readable keywords. Compared to other languages, the syntax and semantics of this language can be easily understood. The usage of comments is similar to the natural language hence the high level of abstraction which makes it easy to follow and debug. Error handling techniques also help to eliminate system crashes which can be costly to banking systems which are expected to be reliable and dependable at all times.
References:
Essay Writing Service Features
Our Experience
No matter how complex your assignment is, we can find the right professional for your specific task. Contact Essay is an essay writing company that hires only the smartest minds to help you with your projects. Our expertise allows us to provide students with high-quality academic writing, editing & proofreading services.Free Features
Free revision policy
$10Free bibliography & reference
$8Free title page
$8Free formatting
$8How Our Essay Writing Service Works
First, you will need to complete an order form. It's not difficult but, in case there is anything you find not to be clear, you may always call us so that we can guide you through it. On the order form, you will need to include some basic information concerning your order: subject, topic, number of pages, etc. We also encourage our clients to upload any relevant information or sources that will help.
Complete the order formOnce we have all the information and instructions that we need, we select the most suitable writer for your assignment. While everything seems to be clear, the writer, who has complete knowledge of the subject, may need clarification from you. It is at that point that you would receive a call or email from us.
Writer’s assignmentAs soon as the writer has finished, it will be delivered both to the website and to your email address so that you will not miss it. If your deadline is close at hand, we will place a call to you to make sure that you receive the paper on time.
Completing the order and download