Uploaded by Phan Trong Nhan (FGW DN)

ASM1 C Sharp

advertisement
ASSIGNMENT 1 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Unit 1: Programming
Submission date
Date Received 1st submission
Re-submission Date
Date Received 2nd submission
Student Name
Duong Van Thanh Son
Student ID
GCD201619
Class
GCD1002
Assessor name
Hoang Nhu Vinh
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Student’s signature
Grading grid
P1
M1
D1
 Summative Feedback:
Grade:
Lecturer Signature:
 Resubmission Feedback:
Assessor Signature:
Date:
Table of Contents
State your simple business problems to be solved ........................................................................................ 3
I.
1)
Overview about Algorithm ................................................................................................................................ 3
2)
Represent a small and simple problem ............................................................................................................. 4
II.
Analyse the problem and design the solutions by the use of suitable methods .......................................... 5
1)
Analyse the problem ......................................................................................................................................... 5
2)
Flowchart ........................................................................................................................................................... 6
III.
Demonstrate the compilation and running of a program ....................................................................... 10
1)
Introduce how the program is solved and screen shots source code of the result ........................................ 10
2)
Run the program ............................................................................................................................................. 12
3)
Explain briefly what Software Development Life Cycle is ............................................................................... 13
IV.
1)
EVALUTATE .............................................................................................................................................. 13
Include Test cases ............................................................................................................................................ 14
2) Evaluate how the problem is solved from the designed algorithm to the execution program written by a
specific programming language: ............................................................................................................................. 14
V.
References ................................................................................................................................................... 15
References ................................................................................................................................................................... 15
I.
State your simple business problems to be solved
1) Overview about Algorithm
Algorithms give us the most ideal option of accomplishing a task to improve the efficiency of a computer program,
proper utilization of resources.
WHAT ALGORITHM MEANS?
An algorithm is a finite sequence of well-defined, computer-implementable instructions, typically to solve a class
of specific problems or to perform a computation.
Algorithms are always unambiguous and are used as specifications for performing calculations, data processing,
automated reasoning, and other tasks. In contrast, a heuristic is a technique used in problem solving that uses
practical methods and/or various estimates in order to produce solutions that may not be optimal but are
sufficient given the circumstances.
An example about an algorithm
2) Represent a small and simple problem
Firstly, I will introduce the C# language. It used in algorithm to solved problem
C# is a general object-oriented programming (OOP) language for networking and Web development. C# is
specified as a common language infrastructure (CLI) language.
In January 1999, Dutch software engineer Anders Hejlsberg formed a team to develop C# as a complement to
Microsoft’s NET framework. Initially, C# was developed as C-Like Object Oriented Language (Cool). The actual
name was changed to avert potential trademark issues. In January 2000, NET was released as C#. Its NET
framework promotes multiple Web technologies.
II.
Analyse the problem and design the solutions by the use of suitable methods
1) Analyse the problem
There is a basic example about a problem that can solve by algorithm.
A teacher wants to manage grade of his class. He asks you to help him to create a small application to
manage them. He needs to enter name, ID, grade of students. Then he needs to print information and
grade together.
After read clearly the scenario, I solved it by using an algorithm based on C# language to create a program
must have full option that satisfy the requirement of teacher. We need to create an application to enter
name, score, ID.
2) Flowchart
Step 1: START
Step 2: DECLARED the
variable n, ID[], grade[],
name[], flag
Step 3: SET flag=false
Step 4: Print menu
Step 5: Input option in
Step 6: If option=1 then
Step 6.1: Call input()
Step 6.2: SET flag=true
Step 6: ELSE (flag=false)
is true, return Step 4.
Step 7: IF option=2 then
CALL showInfo()
Step 8: WHILE option !=
3, repeat Step 3
Step9: STOP
Main of application
Step 1: START
Step 2: PRINT (“Input total student (3-30) ”)
Step 3: PRINT ("1. Input information")
Step 4: PRINT ("2. Show information")
Step 5: PRINT ("3. Exit")
Step 6: PRINT (“Input your choice: “)
Step 7: STOP
Menu list of application
Step 1: START
Step 2: DECLARE the variable i
Step 3: INPUT n;
Step 4: WHILE n<3 | n>30 is true , return
Step 3
Step 6: SET i=0
Step 7: WHILE i<n is true, repeat 8 through
Step 12
Step 8: READ name[i]
Step 9: READ ID[i]
Step 10: READ grade[i]
Step 11: WHILE (grade[i]<0 or grade[i]>10) is
true, return Step 10
Step 12: MOVE UP i by 1 Step 13: STOP
Option1: Input information of students
Step 1: START
Step 2: DECLARE the variable i
Step 3: SET i=0
Step 4: WHILE i<n is true, repeat Step 5 through Step 6
Step 5: PRINT ID[i], grade[i], name[i]
Step 6: MOVE UP i by 1 Step 7: STOP
Option 2: Print information of students
III.
Demonstrate the compilation and running of a program
1) Introduce how the program is solved and screen shots source code of the result
The solution here is I use functions called “switch-case”, each of which has an algorithm to process the
program. And the program use “do-while” function to check the condition.
Firstly, I create variables that using strings to store information into arrays, using integer “I” for “forloop”
functions, using integer “NumberStudent” to get total of students, using Boolean to check and “k” for
“switchcase”.
Input information
Print information
Main program
I start with “Input total students(1-30)” and SET the “do-while” is (n<1 or n> 30). After that I print the menu list has
all of things that teacher needs. In the “switch-case”
• Case 1 is mandatory, run Input () function, after that, assign check=true and return to the menu
•If user choose case 2, it will run showinfo () function, it happens if user input case 1 first. Or not, it will print to
screen “You must input information first.” To make it work, I used if -else structure to control it. Finish case 2,
return to the menu.
•
Then in the case 3, it is the way to quit this application.
2) Run the program
After enter 3 students
After enter information of students
Show information
3) Explain briefly what Software Development Life Cycle is
Software Development Life Cycle (SDLC) is a process used by the software industry to design, develop and test
high quality software’s. The SDLC aims to produce a high-quality software that meets or exceeds customer
expectations, reaches completion within times and cost estimates.
•
SDLC is the acronym of Software Development Life Cycle.
•
It is also called as Software Development Process.
•
SDLC is a framework defining tasks performed at each step in the software development process.
•
ISO/IEC 12207 is an international standard for software life-cycle processes. It aims to be the standard that
defines all the tasks required for developing and maintaining software
IV.
EVALUTATE
1) Include Test cases
No
1
Test case
Verify that student information will
save into array if the user enters
valid
2
Verify that “student’s grade is from 0
to 10. Please enter again is if user
enter invalid student’s grade
3
Verify that “Student
information will displayed
when user choose menu “Show
information student”.
4
Verify that the program exits
when the user selects the
“Exit” menu.
Function
Input name, ID and
grade
Display name, ID
and grade
Result
Pass
Evaluation
The program has performed
effectively and saved the Name,
ID and grade in the array
Pass
The program has performed
effectively and require user value
valid again
Pass
The program has performed
effectively and printed Name
Student ID and Grade from the
array were saved to display
Pass
The program has performed
effectively and printed Name
Student ID and Grade from the
array were saved to display
2) Evaluate how the problem is solved from the designed algorithm to the execution program
written by a specific programming language:
Algorithmic descriptions are written in some type of Pseudocode and describes the general steps to solve a
problem. Pseudocode typically omits details that are essential for machine understanding of the algorithm,
such as variable declarations. The purpose of using pseudocode is that it is easier for people to understand
than conventional programming language code, and that it is an efficient and environment-independent
description of the key principles of an algorithm. In conclusion, an algorithm is a sequence of steps that
describes an idea for solving a problem meeting the criteria of correctness and terminability. A program is a
sequence of steps that is specified at enough det (tutorialspoint, n.d.)ail to be able to run on a machine.
V.
References
References
techopedia, n.d. [Online]
Available at: https://www.techopedia.com/definition/26272/c-sharp
tutorialspoint, n.d. [Online]
Available at: https://www.tutorialspoint.com/sdlc/sdlc_overview.htm
Wiki, n.d. [Online]
Available at: https://en.wikipedia.org/wiki/Algorithm
Download