Procedural Programming (C++)
Procedural Programming (C++)
Procedural Programming (C++)
Assignment No 03
Acknowledgement
I wish to express profound gratitude to my all lecturers who help me throughout this project. My very first gratefulness goes to our lecture, Ms. Vindya for her continuous support, encouragement and also for her valuable advices and guidance. Then I would like to pay my gratitude for my parents for their guidance and financial support and career guidance towards IT in ICBT. I would also like to pay my thankfulness for my colleagues who were sharing the ideas. Thank you.
Assignment No 03
Introduction
This report has been written regarding to the project construct a better computerized billing process system for Amazon Book shop is one of the growing book shops in city area. Since it is a growing book shop and currently the book shop has a customer base of around 200; this is a good idea by the management to implement a computerized billing system to increase their level of customer service and efficiency. The goal of this project to implement an excellent and suitable billing system with the guidelines that are been presented by the management, according to the guidelines and project deadline the author be supposed to develop the system using C++ programming language.
Objectives
The objectives of the project are, Understand the principle of procedural programming. Be able to design procedural programming solutions. Be able to implement procedural programming solutions. Be able to test procedural programming solutions.
Assignment No 03
Executive summary
To become fully qualified HND, IT students we have to fulfil some requirements. We have to complete individual assignment and the final group case study. I know the important of the project. By doing these assignments I can gain much knowledge of the computer devices and procedural programming. Completing my first individual procedural programming assignment successfully it gave me a confidence and courage to face the outer world for the rest of my vocational period. This assignment is a brief study on how organizations maintain their IT security & how they build security according to world stranded manner. I gathered the necessary information for this assignment by browsing some websites and referring some books.
Assignment No 03
Table of Contents
Acknowledgement .................................................................................................................................. 1 Introduction ............................................................................................................................................. 2 Objectives ............................................................................................................................................... 2 Executive summary ................................................................................................................................. 3 Figure table ............................................................................................................................................. 5 Task 01 .................................................................................................................................................... 6 Task 02 .................................................................................................................................................... 9 Task 03 .................................................................................................................................................. 15 Task 04 .................................................................................................................................................. 28 Task 05 .................................................................................................................................................. 37 Task 06 .................................................................................................................................................. 41 Task 07 .................................................................................................................................................. 45 Task 08 .................................................................................................................................................. 47 Task 09 .................................................................................................................................................. 51 Conclusion ............................................................................................................................................. 52 Harvard Reference ................................................................................................................................ 53 Gantt chart ............................................................................................................................................ 54
Assignment No 03
Figure table
Figure 1 - Logo VB ................................................................................................................................... 7 Figure 2 - Logo Java ................................................................................................................................. 8 Figure 3 - System.Login ......................................................................................................................... 28 Figure 4 - system.login - wrong userNm & pass ................................................................................... 29 Figure 5 - system.login - final attemtp .................................................................................................. 30 Figure 6 - unauthorized access ............................................................................................................. 31 Figure 7 - system.MainMenu ................................................................................................................ 31 Figure 8 - system.StoreMenu ................................................................................................................ 32 Figure 9 - system.store.Addbooks ........................................................................................................ 32 Figure 10 - system.store.updatebooks ................................................................................................. 33 Figure 11 - system.createbill.placeorder .............................................................................................. 34 Figure 12- system.Createbill ................................................................................................................. 35 Figure 13 system.HelpMenu ................................................................................................................. 36 Figure 14 - system.AboutUsMenu ........................................................................................................ 36 Figure 15 modularization ...................................................................................................................... 38 Figure 16 - Value parameter passing .................................................................................................... 39 Figure 17 - Reference parameter passing ............................................................................................. 39 Figure 18 - codign example ................................................................................................................... 40 Figure 19 - cording example 2............................................................................................................... 40 Figure 20 - cording example 3 (comments) ......................................................................................... 42 Figure 21 - cording example (Multiline comments).............................................................................. 42 Figure 22 - example froms developed system ...................................................................................... 43 Figure 23 -example froms developed system ....................................................................................... 43 Figure 24 - example froms developed system ...................................................................................... 44
Assignment No 03
Task 01 1.0 Analyze the types of programming languages comparatively to the current programming trends in the field. You may also have to analyze the suitability of the language selected to develop the given program solution.
Programming language A programming language is a computer language developers use to develop programs, script development, web development, or it is a language which a software developer writes some kind of inductions for a computer to execute or perform a specific task. There are number of programming languages available in current programming trends in the field, every programming languages has their own set of keywords and some special syntax in order to perform a task. Before explaining that author prefers to give details about two types of programming languages there are, Low level programming languages: - these are call machine languages, when you using these languages its difficult to understand or use it because this content symbols, ones and zeros. These kinds of programming languages are difficult to handle or understand. But the advantages can classify as computer can understand this languages easily because this is a computer language therefore computer will process information quickly. High level programming languages: - this is also known as higher-order language, these kind of programming languages easy to understandable for humans because its configure in English. This allows the developer focus on the judgment of the problem rather than interact with machine code languages which are low level language. There are plenty of high levels programming languages available in present such as C, C++, visual basic, java etc. However the high level languages should translate to machine languages so computer can understand those instruction, this can be done by two ways either uses of compiler or with the use of interpreter. By the interpreter the source code is translated to machine code language line by line. By the compiler the entire source code is translate into machine code at ones.
Assignment No 03
Visual basic programming language is extension of BASIC programming language, visual programming language and development kit is created by Microsoft. Visual basic offer a graphical user interface that let the programmer to drag and drop items into the program in addition manually generate program code. Visual basic is also call as VB; this is created to generate software easily and efficient. This programming language is a high level
programming language which can be understandable by humans without difficulty. The softwares produced is visual basic can be proposed to run on windows, mobile device or on the web.
Figure 1 - Logo VB
Java This is a programming language developed by Sun Microsystems. The syntax of java is very similar C/C++. Java is also used to implement small programs that can be embedded into websites. This language is becoming more popular among web developers and software developers because of its efficiency and simple to use. The Sun Microsystems express java as secure, simple, interpreted, high performance, dynamic programming language.
Assignment No 03
C++ Programming language C++ pronounce as C plus plus, its a programming language that was construct with the help of C programming language. The C and C++ syntax are almost the same, but C++ has object oriented facility which let developer to generate objects among the code this create programming easier and efficient. Today the most software programs are written in C++ because of the efficiency and power of the language even the Windows XP, Windows 95, Microsoft visual studio, adobe series are written using C++ programming language. To develop a computerized billing system to Amazon bookshop we have chosen C++ programming language because, This is the most powerful language than other programming languages. We can approximately do anything with this programming language. Compare with older programming languages this is easy to use and understandable. The C++ programming languages output will function extremely fast. Including functions is a extremely valuable feature that let your code to be dynamic and standard.
Assignment No 03
Task 02
Design the flow chart for the above solution, using a range of symbols, which can be used with flowcharting.
Assignment No 03
10
Assignment No 03
11
Assignment No 03
12
Assignment No 03
13
Assignment No 03
14
Assignment No 03
Task 03 Develop the appropriate pseudo code for the above solution
15
Assignment No 03
16
Assignment No 03
17
Assignment No 03
18
Assignment No 03
19
Assignment No 03
20
Assignment No 03
21
Assignment No 03
22
Assignment No 03
23
Assignment No 03
24
Assignment No 03
25
Assignment No 03
26
Assignment No 03
27
Assignment No 03
Task 04 User manual for the developed solution to assist the users to work with it.
As the requirement of the company to prepare a user document for the developed solution to assist the users work with it, the following statements and figures are going to be help the user to work with the billing system,
Figure 3 - System.Login
The above picture indicates the start point of the system, once the user run the system first of all he should login, Authantication Levels There are three login levels implemented for this programe, 1. 2. 3. 4. Admin User Store Keeper Guest
Default password is 123, Admin have all previlages in side the programe, Add new books Update book information Remove books Place orders Create invoice
Umesh Raginda Munasinghe | HND / 49 / 22 | ICBT City Campus 28
Assignment No 03
User have basic functions, he can maintain books store & can only view books, place orders & create invoice. This level may useful to cashier to do his job. Store keeper can only maintain books information, he is responsible to add books, update & remove books. Guest can access to the system, but he can only wive the system. This level may be helpful to customers to know available books & available quantity.
Limited Login Attempts That means user can not enter wrong user name & password any time, if we alow user to enter wrong passwords any number of times, some times they may able to mis use login information. Because of that I had provided only 3 login attempts & after 3rd attempt program will shout down. Fowwowing screen show how after inserting wrong information to 1st & 2nd login attempt, system show eroor massage to the user.
29
Assignment No 03
If user provide wrong information for thired attempt system show following massage. Which meanse use had enterd wrong password for 3 times. Because of that system shows warning massage to the user & force user to exit from the program, next user have to press enter button & programe will shotdown.
Well, now we are going inside of the programme, only admin can access all functons, if any one try to access a function which he dont have permmition, system will show eroor massage, Ex Now I logged as basic user (Cashire), & I went to store menu. It shows all functions system can do, but as cashier I should no I cannt update book information, but I select No 2, which meanc I try to add new books. When I press enter following screen will display,
30
Assignment No 03
Now I going to show all functions. I logged as Admin, because of that I can access every function. Main Menu
Figure 7 - system.MainMenu
31
Assignment No 03
the main menu of the system will appear here user have 6 options; book information option to verify books, add books and modify books, place an order option to generate bills, and other options for help, logout and exit the system.
Figure 8 - system.StoreMenu
If user select book information this is the form user will get, here as we can see the book informations are shown in top and there are three option call add book informations modify and main menu in order to add a book user should enter 1 to modify user should enter 2.
Figure 9 - system.store.Addbooks
32
Assignment No 03
This is the add book informations form, once this appear it will ask for book informations, in above picture I have filled the informations in proper way and once user enter the informations system will ask whether do you want to add another if yes user should enter y or else n.
Lets think books prices are want to change, lets update books information,
Figure 10 - system.store.updatebooks
The above picture shows modify book information form and how to enter proper data, if user want to modify any book information this is the place, first user must enter the record ID which should be modify after all user should enter new book informations.
33
Procedural programming (C++) Billing process Lets see how create invoice & palce order
Assignment No 03
Figure 11 - system.createbill.placeorder
The above picture indicates place an order option in main menu of the system, once sure select place an order option in order to generate a bill, first of all user should enter customer ID if that customer doesnt have an ID user can enter underscore ( _ ) then customer name, after that record ID once the record ID has been enter the information of the relevant record ID will appear then system will ask for quantity that should be add to the bill once everything entered system will ask whether user want to add another book to the bill or print the bill based on the response the system will react
Umesh Raginda Munasinghe | HND / 49 / 22 | ICBT City Campus 34
Assignment No 03
This is the bill form, this contain customer name , customer name, date and book id, book code, quantity, total likewise user can add any amount of books to the bill and below the grand total will appear with 5% TAX according to the requirement.
Back, Log Out & Exit Inside the main menu we can find Exit. If not user have to come to main menu to exit. When we are going inside of the programme from the main menu you can find Logout & Back selctions, Using these selections, user can easily contrall system.
35
Assignment No 03
Theses are comment interfaces of every programme, we add user manual to following menu.
Figure 13 system.HelpMenu
Figure 14 - system.AboutUsMenu
36
Assignment No 03
Task 05 Modularize the proposed programming solution using a specific method to reduce the complexity of the task programming. There by identify the types of parameter passing and implement effective data passing between developed modules.
Modularization In C++ programming language the most excellent element or ability that we can group some lines of code into a unit and that can be called to execute whenever we want. The programs which are divided into subprogram are call modularization. This method is also known as procedure, macro, sub-routine, module and function. Author is going to use the term
function; functions are significant because they let us to divide huge complex programs into smaller manageable parts. As the function is minor piece of the overall program, programmer can focus on what he want it to do. Generally functions are two types 1. Value returning function: - function that has a data type called value returning function. 2. Void functions: - functions that do not have a data type called void function.
Functions
predefined function
void functions
Complexity of project task will reduce. It will be easy to do modification because the functions are separated. After declaring a variable it can be call any number of times so that we can reduce the size of coding.
Umesh Raginda Munasinghe | HND / 49 / 22 | ICBT City Campus 37
Assignment No 03
Figure 15 modularization
Parameter passing Parameter is a memory location which receives values to the function from the place that we call (from the function call). Passing values from one function to another at that time of calling a function we call it as parameter passing technique. Parameters are two types, 1. Formal parameter: - a variable declared in the function heading. 2. Actual parameter: - a variable expression listed in a call to function. Data passing can be done from one function to another function using parameters. There are two types of parameter data passing techniques available, 1. Value parameter passing: - in this parameter passing technique formal parameters which are specified with the function heading receive copies of contain of corresponding actual parameters. Example given below,
38
Assignment No 03
2. Reference parameter passing: - here, formal parameters that receives the location (memory address) of the corresponding actual parameters call reference parameter passing. Example given below,
Parameter passing technique applied when implementing the given scenario The below pictures will show you how I used parameter passing to the given scenario,
39
Assignment No 03
Here I have call a function call tax, while calling the function I have pass a variable entitle as gtotal which is already contain a value; while passing the gtotal value I have equalized it into same gtotal variable because when the tax function returning the value of gtotal is may change.
After passing the contain of variable gtotal; as you can see in the highlighted fraction I have declared a variable which has same name logically its identify as formal parameter and finally its returning the formal parameter contain to the actual parameter.
Umesh Raginda Munasinghe | HND / 49 / 22 | ICBT City Campus 40
Assignment No 03
Task 06 Document the code provide good understanding of the program and its functionalities using different types of comments, which will make future maintenance of the developed program solution easier
Comments in C++ A comment is a content that the compiler will do not take into account however that is need to programmers. Comments are generally make use to create notes on code for future situation. The compiler will ignore whatever statement that includes in the comment criteria. In Microsoft visual studio the comments are highlighted in green color, the compiler care them as white space. Programmers can apply comments as testing the program by make certain lines of code inactive using commenting the code. There are some procedures in order to include a comment and that based on which type of comments you are trying to include. There are two types of comments, Single line comments Multi line comments
Single line comments Programmers use single-line comments to include a comment to a particular line in the code. There are some situations to include this structure; include a small note in single line what a portion of code going to generate. Single line comments normally make use to clarify a tiny code snippet. You can include single-line comments for any small comment that in single line. To show the particular line is a comment head the comment with the two forward slashes (//), as shown in the following example,
41
Assignment No 03
The line which is starting with two slashes is a single line comment.
Multiline comments Multiline comments are also known as block comments, this structure use for comments which are several lines in extent. Software developers usually use multiline comments to describe data configuration, method, and description of the project etc. To generate a multiline comment, add /* at the start of the commented row and add */ at the end of the comment line. This method let programmers create extended comments rather than adding two slashes at the beginning of every line. The layout for multiline comments is as follows,
42
Procedural programming (C++) The statements which is appear between /* and */ its multiple line comments. Comments used in given system
Assignment No 03
43
Assignment No 03
44
Assignment No 03
Task 07 for the developed program application, produce a test plan with appropriate test cases to carry out the testing process
Expected Result 1) Error message displayed incorrect user name or password is entered, please try again.
TC2
Five defined numbers should appear to do an action if user types a number which is undefined
A error massage displayed sorry the value entered is undefined or invalid, please input a correct value
TC3
Two defined numbers should appear to do an action if user types a number which is undefined
A error massage displayed sorry the value entered is undefined or invalid, please input a correct value
TC4
Relevant to record ID the book information should appear and ask for quantity customer wants
A message should appear order is placed do you want to place another (yes/no)
45
Procedural programming (C++) TC5 Checking functionality of log out fraction User types number four in main menu
Assignment No 03
The system be supposed to log out and be supposed to type user name and password again
TC6
A message come into view do you really want to exit the system (yes/no)
TC7
User types number one in book The program should ask information user record ID, book ID, available quantity and price and a message appear record is added do you want to add another (yes/no)
TC8
Both books total should be add and the grand total should include 5% TAX
46
Assignment No 03
Task 08 Explain the testing techniques which you think will be most effective to test the developed program solution. You must also have to conduct testing the program according to the developed test plan and provide an analysis of testing conduct
Black box testing Black box testing is a testing strategy, which does not require any familiarity of internal design or code. The kinds of testing are totally focused on the testing requirements and the functionality of the software. In black box testing they do boundary level analysis and error guessing. The base of this testing approach lies in the choice of suitable data as per functionality and testing it against the functional specifications to test for usual and unusual actions of the system. In order to execute Black Box Testing Strategy, the tester is required to be careful with the software requirement specification, and as a client should identify how the system must perform in reply to the particular action. I suggest this will be most suitable testing technique. White box testing White box testing is also known as open box testing, clear box testing and glass box testing. To do this testing tester must know internal logic and structure of the code because its deal with programming, therefore normally this testing done by the programmer. In this testing method they not care about syntax error or small coding mistake they check its related to the scenario or objective. To execute white box testing, the tester has to deal with the syntax/code and therefore is required to have knowledge of coding and logic internal working of the code. White box test also needs the tester to check into the code and discover which statement or unit of the code is faulty or not working. I suggest this testing strategy also will be most suitable for the developed system.
47
Assignment No 03
To test what occurrences if the user enter incorrect user name or password
Michele An error message should appear incorrect user name or password is entered, please try again
02 To test what occurrences if the user enter correct user name and password
Amazon, icbt A message should appear access granted to the system then system should ask for the date and main menu should appear
A message appeared and main menu appeared Actual results matched expected result
03 To test what occurrences if the user enter undefined numbers in main menu
7 A message should appear sorry the value entered is undefined or invalid, please input a correct value and again system should allow user to command
A message appeared and again its allows user to command again Actual results matched expected result
48
Procedural programming (C++) Test case Test objectives Test data Expected results Actual results Conclusion 04
Assignment No 03
To test whether book ID field accept characters and numeric values C100 Book ID field should accept both values Book ID field accepted both values Actual results matched expected result
05 To test what occurrences if the user enter undefined numbers in book information form
5 A message should appear sorry the value entered is undefined or invalid, please input a correct value and again system should allow user to command
A message appeared and again its allows user to command again Actual results matched expected result
06 To test what occurrences if user select add book informations option System should ask book ID, book code, available quantity, price and whether user wants to add another book information if user select yes system should allow to add another book information if user select no system should move to book information form
Actual results
System asked for book ID, code, available quantity, price and if user select yes the system allows user to add information again if user select no the system moves to book information form
Conclusion
49
Assignment No 03
To test what occurrences if user select modify book information System should ask for the record id which should be edit and it should ask for book ID, book code, available quantity, price to renew the informations and system should move to book information form System asked for record id which should be edit and the informations to renew and system moved to book information form
Actual results
Conclusion
08 To test what occurrences if user select place and order option System should ask for customer ID number, customer first name, record ID number and system should show the information of relevant record ID and its should ask the quantity thats customer wants
Actual results
System asked for customer ID, customer first name, record ID and its shows the information of relevant record ID and its asked for quantity customer wants
Conclusion
09 To test the functionality of billing form Once the customer entered the record ID and the quantity he wants, the billing form should indicate customer name, ID, Date, book ID, book code, quantity, price and the total and Grand total
Actual results
Billing form indicates customer name, ID, Date, book ID, book code, quantity, price and the total and Grand total
Conclusion
50
Assignment No 03
Task 09 Critically analyze the limitations of the developed program solution and make recommendations for improvements.
There are several limitations in developed program since it is a command line interface (CLI); these are the limitation of a CLI program, 1. Because of the memorization and experience required to work with a command line interface new end-users find it much harder to successfully operate and control a command line interface program. 2. Command line interfaces do not offer simplicity and ability to view multiple things at once; multi tasking is frequently not possible. 3. Not user friendly, especially to a new user. 4. No capability to embed media like photos, videos etc. 5. For the developed program solution user can only to add book informations, modify book informations and generate bills these are the boundaries or limitations. Since the amazon book shop in development stage in future they can transform command line interface (CLI) billing process system into graphical user interface (GUI) because its more user friendly then CLI, it can be developed with efficient new technologies. Furthermore I like to suggest bar code system to the billing system it has the characteristics of detect book name and other relevant book informations. Into GUI interface system as a developers we can create a more handy and attractive interface and its more user friendly then CLI. Most end users have a lesser learning curve using a graphical user interface.
51
Assignment No 03
Conclusion
In the conclusion I highlight an appropriate computerized billing system has been presented by me to the Amazon book shop, since the aim of this project to generate a billing system. Aim of the make this project is automated current manual system. I could be able to give a proper interpretation for the user need. How can I say like this? Because company had given me more than one month time period to execute their need. So I planned my work and made it easier. At the beginning I made this project from general to specific and at the end I want to reflect this from specific to general. What is the user need? I realized it from the very first beginning and now it has only to implement. I thought in every time what are the long term advantages that company will get throughout this system, once Im doing the project. I did not keep my ideas inside a frame. I was thinking in every single time what the new modifications that parallel can run with system. According to the proposed system it may brings out many future benefits for the company also. I had fulfilled the management rule and through identifying their significant requirements of the manual system, I have build the automated billing system and I have recommended suitable new technology systems and components that match with the scenario as well which helps to increase the level of customer service. Due to requirement I have demonstrate some programming related materials, program testing techniques and user manual document which helps the user to work with the system. Eventually I believe I have successfully completed this project by creating an error free and effective billing software system for Amazon book shop.
52
Assignment No 03
Harvard Reference
DesignFest, Oct. 21, 2000. Viking direct marketing system [Online] Available at: <http://designfest.acm.org/Solutions/Viking/Viking_Solution_1_00.htm> 15/04/2013] [Accessed
Captainmoe (2010) YouTube - Visual C++ - Tooltip Control. [Online] Available at: http://www.youtube.com/watch?v=emrvGgJdq6E [Accessed 18/04/2013] testingmantra.com, 2009. Test Plan [online] Available at: <http://www.testingmantra.com/Articals/Test_Plan_-_Objectives_and_Benefits.html> [Accessed 20/04/2013] Andrew Binstock, November 30, 2005. C and C++ give way to managed code Java and C# are becoming the application languages of choice for enterprise developers [Online] Available at: <http://www.infoworld.com/d/developer-world/c-and-c-give-way-managedcode-444> [Accessed 22/04/2013] Catalin Cimpanu , January 21st, 2010. Top Web Trends for 2010 - Part III - Programming Trends [Online] Available at: <http://news.softpedia.com/news/Top-Web-Trends-for2010-Part-III-Programming-Trends-132714.shtml> [Accessed 24/04/2013]
53
Assignment No 03
Gantt chart
54
Assignment No 03
55