[go: up one dir, main page]

100% found this document useful (1 vote)
178 views34 pages

Assignment Cover Sheet Qualification Module Number and Title

The document is an assignment cover sheet for a student named ISURU MANOD submitting their coursework for the module CSE 4002 Fundamentals in Programming. The submission is a report and software of 3000 words due on August 27th, 2021. The student declares that the work submitted is their own and sources are fully acknowledged. Feedback and marks will be provided by the assessor. The assignment tasks the student to discuss key concepts in programming including selection structures like if/else statements and switch cases, repetition structures like while, for, and do-while loops, and modularization using functions. Examples are provided for each structure.

Uploaded by

IM 99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
178 views34 pages

Assignment Cover Sheet Qualification Module Number and Title

The document is an assignment cover sheet for a student named ISURU MANOD submitting their coursework for the module CSE 4002 Fundamentals in Programming. The submission is a report and software of 3000 words due on August 27th, 2021. The student declares that the work submitted is their own and sources are fully acknowledged. Feedback and marks will be provided by the assessor. The assignment tasks the student to discuss key concepts in programming including selection structures like if/else statements and switch cases, repetition structures like while, for, and do-while loops, and modularization using functions. Examples are provided for each structure.

Uploaded by

IM 99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 34

Assignment Cover Sheet

Qualification Module Number and Title


HD in Computing and Software Engineering CSE 4002
/Network Technology and Cyber Security Fundamentals in Programming
Student Name & No. Assessor
ISURU MANOD(KD/HDCSE/CMU/54/06) Mrs .Dushyanthi Nisansala

Hand over date Submission Date

22.06.2021 27.08.2021
Assessment type Duration/Length of Weighting of Assessment
Assessment Type
Report and Software
Coursework Submission 100%
(3000 words)

Learner declaration

I, ISURU MANOD(KD/HDCSE/CMU/54/06) certify that the work submitted for this assignment is
my own and research sources are fully acknowledged.

Marks Awarded
First assessor

IV marks

Agreed grade

Signature of the assessor Date

1
FEEDBACK FORM
INTERNATIONAL COLLEGE OF BUSINESS & TECHNOLOGY

Module: CSE 4002

Student :

Assessor :

Assignment : FIP

Strong features of your work:

Areas for improvement:

Marks Awarded:

2
Introduction

Depending on the system, this is primarily user authentication, since user authentication helps
protect the user's privacy. Users have to log in to the system using their username and password.
Once the username and password are entered correctly, the user can enter the system. If it is
entered incorrectly, it will not be able to enter the system .The customer must have a unique
username and password when we add new customers to the system. The username and password
should be accessible to them after all steps have been completed. This allows them to view and
add products and packages.

3
Task 1
Managing the software development process is called the "programming process". We do not
understand the language we use in everyday computer conversations. Therefore, we do not
understand the binary language used to perform tasks on a computer, so we need to write
instructions in a specially defined language such as C ++. C ++ is similar to natural language and
can be understood by a computer after it has been consistently translated.

1. Controlling structures

1.Selection structures

2.Repitition structures

3.Sequence Structure

4
1.1 Selection structures
C ++ programs are systematic selection structures based on conditional expressions. The
selection structure is the type of control structure used to select an instruction or series of
instructions to be executed under certain conditions. The program instructions are written in a
simple order, but the selection structure is also called the decision structure and the conditional
structure. There are three ways to make a decision in the selection structure:

1. IF Statement

2. IF ELSE Statement

3. Nested ELSE IF

4. Ternary / Conditioned Operators

5. Switch Case

5
1.1.1 IF Statement
In this declaration, the user specifies a condition, if the condition is true, the program will take
action, and if the condition is false, the program will continue or run. One of the important
functions of an If statement is to allow a program to choose an action based on user input.
Whether the condition is called one-way or one-way because it chooses or skips an action.
[ CITATION tut16 \l 1033 ]

OUTPUT

a is less than 20;

value of a is : 10 [ CITATION tut16 \l 1033 ]

6
1.1.2 IF ELSE Statement
“If/ else the user receives a condition of the "If/ elset ype. In a If/ else selection structure, if the
condition is true, then in the if block the program is executed or if the condition is false. , the
program runs in another block. It is also known as bi-directional design or dual choice design
because it chooses between two different actions at the same timeThis Control Structure allows a
program to follow alternative paths of execution, whether a condition is met or not.”[ CITATION Die20 \l
1033 ]

OUTPUT
a is not less than 20;
value of a is : 100 [ CITATION tut16 \l 1033 ]

7
1.1.3 Nested ELSE IF
“A nested if is an if statement that is the target of another if statement. Nested if statements means an if
statement inside another if statement. Yes, C++ allows us to nest if statements within if statements. i.e, we
can place an if statement inside another if statement. ”[ CITATION you18 \l 1033 ]

Output:
i is smaller than 15
i is smaller than 12 too

8
1.1.4 Conditioned Operators
“The conditional operator is an operator used in C and C++ (as well as other languages, such as C#).

The ?: operator returns one of two values depending on the result of an expression.”[ CITATION pro18 \l
1033 ]

Output

Enter your marks: 80

You passed the exam.

9
1.1.5 Switch Case
“The switch case statement is used when we have multiple conditions and we need to take another action
based on the condition. When we have several conditions, and we need to execute a block of statements
when a certain condition is met. In this case, we can use a Long if statement .elseif or a case switch. The
problem with long if..else if is that it gets more complicated when we have a lot of conditions. Switch
housings are a clean and efficient way to deal with these situations..”[ CITATION jav20 \l 1033 ]

Output

" Tuesday " (day 2)

10
1.2. Repetition structures
The Repitition constructs is used when a program needs to repeat one or more instructions. When
a condition is encountered during iteration, the loop ends at that point. In addition, the Repetition
construct is used to execute the loop. The programmer can enter a large amount of data into the
program using a limited number of variables.

1. while structure

2. for structure

3. do-while structure

11
1.2.1 While structure
“while loop statement executes the target statement repeatedly as long as the given condition is
true. And the programmer can create an infinite loop with the while loop. In the while loop, first
test the while loop to see whether the program being executed is true.”[ CITATION dev20 \l 1033 ]

Output

12345 [ CITATION pro18 \l 1033 ] ”

12
1.2.2 For structure
“A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute
a specific number of times. In a for loop, the initial statement first initializes the variable. Then, if the
loop condition is true, the original statement has been executed and the for loop statement is executed, the
statement is updated and repeated until the condition becomes false.”[ CITATION csu18 \l 1033 ]

OUTPUT

value of a: 10

value of a: 11

value of a: 12

value of a: 13

13
1.2.3Do-while structure
“In do while loop also the loop execution is terminated on the basis of test condition. The main difference
between do while loop and while loop is in do while loop the condition is tested at the end of loop body,
i.e. do while loop is exit controlled whereas the other two loops are entry controlled loops.” [ CITATION
tut16 \l 1033 ]

Output:

1 , 2 , 3 ,4 ,5

14
1.3. Sequence Structure
A sequential governance structure is the simplest of the three basic governance structures and is
the most common type of governance structure. This structure allows the computer to process
instructions one at a time.[ CITATION edu20 \l 1033 ]

15
1.4 Modularization
“The concept of modular programming originated in the 1960s to help users. Programmers began to
divide the more extensive programs into smaller parts. Though the concept of modular programming is
six decades old, it is the most convenient programming method.”[ CITATION jav20 \l 1033 ]

“The main program must establish the existence of functions used in that program. Depending on the
programming language, there is a formal way to ”[ CITATION Ken15 \l 1033 ]

1.define a function

2.call a function

3.declare a function [ CITATION Ken15 \l 1033 ]

“Functions are important because they allow us to take large complicated programs and to divide them
into smaller manageable pieces.” [ CITATION Ken15 \l 1033 ]

There are two main types of modularity functions

1. Library Defined Functions

Functions included at the top of a C++ Program that already have a definition for itself are called Library
Functions. When these functions are inserted to the C++ program, we use “include<filename>”. Below
are some of the examples for Library Functions.[ CITATION you18 \l 1033 ]

2. User-defined Functions

A custom function is a function that is declared and defined by the user himself. When we write a
program, if there are no library functions available to accomplish a specific task, we write our own
function to perform that task. An example of a custom function as a main function. [ CITATION you18 \l
1033 ]

16
TASK 2

2. Flow Charts

2.1 Main

17
This is the main function of this application. Here are three different options for users. Through it, the
user can enter the "Login" option, the "Help" option or the "Exit" option by entering the corresponding
number provided by the system.

If Number = 1

18
 When the user enters a number, and if the number is 1, the condition will be true. When the
condition is true, the user can log in.

If Number = 2

 When the user enters a number and if the number is 2, the condition will be true. When the
condition is true, then the user can read the "HELP" option provided by the program.

If Number = 3

 When the user enters a number and if the number is 3, then the condition will be true when the
condition is true and the user can exit the program.

2.2 Login

19
This is the "Login" function of this program. The user can log in by entering a valid username and
password.

20
2.3 Main Menu

21
This is the main menu of this program. Here the user can select the category that the user is looking for.
In addition, when finished, the user can log off.

If Number = 1

 When the user enters a number and if the number is 1, the condition will be true When the
condition is true and then the user can go to manage the bakery categories

If Number = 2

 When the user enters a number, and if the number is 2, the condition will be true. When the
condition is true, the user can go to the management of the category "Dessert".

If Number = 3

 When the user enters a number and if the number is 3, the condition will be true. When the
condition is true and then the user can go to manage the beverage category

If Number = 4

 When the user enters a number and if the number is 4, the condition will be true. When the
condition is true, and then the user can go to manage the categories Events Packages

If Number = 5

 When the user enters a number and if the number is 5, the condition will be true. When the
condition is true, then the user can log out. programs.

22
2.4 Bakery Products

It is a function of this baked goods program where the user can view all available baked goods records
and the option to add a new baked goods record to the program. Also, when done, the user can choose to
return to the menu.

23
2.5 Dessert

This is the Dessert function of this program. Here the user can see all available dessert records and the
ability to add a new dessert record to the program. In addition, when the user is finished, he has the option
to return the menu.

24
2.6 Beverages

This is the function of the drinks in this program. Here the user can see all available beverage records and
the ability to add new beverage records to the program. In addition, when the user is finished, he has the
option to return to the menu.

25
2.7 Packages

This is the function of the package of this program, here the user can see all available records of
packages, their details, as well as add a new package record to the program. The ability for users to search
for the packages they are looking for. In addition, when the user is finished, he has the option to return to
the menu.

26
TASK 4

4 . Test case and Result

4.1 MAIN MENU


TEST CASE TEST TEST DATA EXPECTED ACTUAL CONCLUSION
ID OBJECTIVE RESULT RESULT

TC01 Test Menu 1 Login to Main Login to Pass


Menu system
TC02 Test Menu 2 Go to help Go to help Pass

TC03 Test Menu 3 Exit from Exit from Pass


system system
TC04 Test Menu 10 Get error Get error Pass
Message

4.2 Login
TEST CASE TEST TEST DATA EXPECTED ACTUAL CONCLUSION
ID OBJECTIVE RESULT RESULT

TC05 Entering Correct Login to Main Displaying Success


Username & username and Menu “Login
Password password Successful”
TC06 Entering Incorrect Get error Displaying Unsuccess
Username & username and “Login
Password password Unsuccessful”

4.3 Menu
27
TEST CASE TEST TEST DATA EXPECTED ACTUAL CONCLUSION
ID OBJECTIVE RESULT RESULT

TC07 Test Menu 1 Bakery Login to Pass


Products Bakery
Menu Products
TC08 Test Menu 2 Desserts Login to Pass
Menu Desserts
Menu
TC09 Test Menu 3 Beverages Login to Pass
Menu Beverages
Menu
TC10 Test Menu 4 Event Login to Pass
Packages Event
Menu Packages
Menu
TC01 Test Menu 5 Logout Logout Pass

TC02 Test Menu 10 Get error Get error Pass

4.4 Bakery products

28
TEST CASE TEST TEST DATA EXPECTED ACTUAL CONCLUSION
ID OBJECTIVE RESULT RESULT

TC11 Test Bakery 1 Display Display Pass


Product menu available available
Product list Product list
TC12 Test Bakery 2 Open item add Open item add Pass
Product menu Function Function
TC13 Test Bakery 3 Go Previous Go Previous Pass
Product menu menu menu
TC14 Test Bakery 10 Get Error Get Error Pass
Product menu
TC15 Test New Item Enter New Item added Bakery Pass
Adding Item Products
Successfully
added

4.5 Desserts

29
TEST CASE TEST TEST DATA EXPECTED ACTUAL CONCLUSION
ID OBJECTIVE RESULT RESULT

TC16 Test Dessert 1 Display Display Pass


menu available available
Dessert list Dessert list
TC17 Test Dessert 2 Open items Open items Pass
menu add Function add Function
TC18 Test Dessert 3 Go Previous Go Previous Pass
menu menu menu
TC19 Test Dessert 10 Get Error Get Error Pass
menu
TC20 Test New Enter Dessert Item added Dessert Pass
Dessert Item Type Successfully
Adding added

4.6 Beverages

30
TEST CASE TEST TEST DATA EXPECTED ACTUAL CONCLUSION
ID OBJECTIVE RESULT RESULT

TC21 Test Beverages 1 Display Display Pass


menu available available
Beverages Beverages
list list
TC22 Test Beverages 2 Open items Open items Pass
menu add Function add Function
TC23 Test Beverages 3 Go Previous Go Previous Pass
menu menu menu
TC24 Test Beverages 10 Get Error Get Error Pass
menu
TC25 Test New Enter Item added Beverages Pass
Beverage Beverages Successfully
Item Adding Type added

4.7 Event Packages

31
TEST CASE TEST TEST DATA EXPECTED ACTUAL CONCLUSION
ID OBJECTIVE RESULT RESULT

TC26 Test Event 1 Display Display Pass


Package menu available Event available Event
Package list Package list
TC27 Test Event 2 Open Package Open Package Pass
Package menu add Function add Function
TC28 Test Event 3 Open Search Display Enter Pass
Package menu Function ID to search
TC29 Test Event 4 Go Previous Go Previous Pass
Package menu menu menu
TC30 Test Event 10 Get Error Get Error Pass
Package menu

References

32
Beal, V., 1996. object-oriented-programming-oop/. [Online]
Available at: https://www.webopedia.com/definitions/object-oriented-programming-oop/
[Accessed 20 08 2021].

cs.utah, 2018. ~germain/PPS/Topics/for_loops.html. [Online]


Available at: https://www.cs.utah.edu/~germain/PPS/Topics/for_loops.html
[Accessed 25 08 2021].

developer.mozilla.org, 2020. en-US/docs/Web/JavaScript/Reference/Statements/while. [Online]


Available at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while
[Accessed 25 08 2021].

edu.gcfglobal.org, 2020. sequences-selections-and-loops/1/. [Online]


Available at: https://edu.gcfglobal.org/en/computer-science/sequences-selections-and-loops/1/
[Accessed 24 08 2021].

Environ, December, 2008. J. Appl. Sci.. Vol. 12(4) 41 - 46 ed. s.l.:JASEM.

javatpoint, 2020. what-is-modular-programming. [Online]


Available at: https://www.javatpoint.com/what-is-modular-programming
[Accessed 20 08 2021].

Leroy, K., 2015. A Modular Structured Approach using C++. s.l.:s.n.

programiz, 2018. cpp-programming/do-while-loop. [Online]


Available at: https://www.programiz.com/cpp-programming/do-while-loop
[Accessed 20 08 2021].

tutorialspoint, 2016. cplusplus/cpp_if_else_statement. [Online]


Available at: https://www.tutorialspoint.com/cplusplus/cpp_if_else_statement.htm
[Accessed 20 08 2021].

youth4work, 2018. Talent/C-Language/Forum/132643-what-are-library-functionsgive-some-examples?


yFast=On. [Online]
Available at: https://www.youth4work.com/Talent/C-Language/Forum/132643-what-are-library-
functionsgive-some-examples?yFast=On
[Accessed 24 08 2021].

Yse, D. L., 2020. essential-programming-control-structures-2e5e73285df4. [Online]


Available at: https://towardsdatascience.com/essential-programming-control-structures-2e5e73285df4
[Accessed 20 08 2021].

33
34

You might also like