Unit 1: Programming assignment1, Schemes and Mind Maps of Computer science

Unit 1: Programming assignment1

Typology: Schemes and Mind Maps

2021/2022

Uploaded on 04/24/2023

unknown user
unknown user 🇻🇳

1 document

1 / 34

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ASSIGNMENT 1 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Unit 1: Programming
Submission date
08/09/2022
Date Received 1st submission
Re-submission Date
Date Received 2nd submission
Student Name
Ngo Thanh Tung
Student ID
GCH220075
Class
GCH1104
Assessor name
Đng Trn Long
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
Tung
Grading grid
P1
M1
D1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22

Partial preview of the text

Download Unit 1: Programming assignment1 and more Schemes and Mind Maps Computer science in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 1: Programming Submission date 08/09/2022 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Ngo Thanh Tung Student ID GCH Class GCH1104 Assessor name Đặng Trần Long 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 Tung Grading grid P1 M1 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

  • Introduction……………………………………………………………………………………………….
  • application……………………………………………………………………………………………….. P1. Provide a definition of what an algorithm is and outline the process in building an
      1. Overview about Algorithm……………………………………………………………………….
      • 1.1. Definition of algorithms……………………………………………………………………
      • 1.2. How do computer algorithms work?……………………………………………………..
      • 1.3. Example…………………………………………………………………………………….
      1. Characteristic algorithm………………………………………………………………………….
      • 2.1. How problem is solved…………………………………………………………………….
      • 2.2. Source code and screenshots……………………………………………………………
      1. Software Development Life Cycle (SDLC)…………………………………………………….
      • 3.1. What is SDLC?…………………………………………………………………………….
      • 3.2. Represent a small and simple problem…………………………………………………
      • 3.3. Analyze the problem………………………………………………………………………
      • 3.4. Activity Diagrams………………………………………………………………………….
      • 3.5. Flowchart……………………………………………………………………………………1
  • M1. Determine the steps taken from writing code to execution..…………………………………..
      1. Source code……………………………………………………………………………………...
      • 1.1. Declare variable and array……………………………………………………………….
      • 1.2. Select menu function……………………………………………………………………..
      • 1.3. File Program.cs………………………………………………………………………..….
        • 1.3.1. Declare variable and array……………………………………………………...
        • 1.3.2. Select menu function…………………………………………………………...
        • 1.3.3. Input student’s information……………………………………………………..
        • 1.3.4. Print student’s information……………………………………………………...
        • 1.3.5. Print the student with the highest / lowest grade…………………...………..
        • 1.3.6.. Search for the student with the matching ID……………………………......
        • 1.3.7. Removing a student inside the student list…………………………………...
        • 1.3.8. Sorting student by grade descending / ascending………………………..…
        • 1.3. 9 Exiting the program……………………………………………………..………
      1. Result…………………………………………………………………………………………….
      • 2.1. Input student’s information……………………………………………………………….
      • 2.2. Print out student’s information…………………………………………...……………...
      • 2.3. Display the student with the highest grade / lowest grade….…………………….....
        1. 4 Search for the student though student’s ID…………………………...……………….
        1. 5 Remove a student in student list……………………..…………………………………
      • 2.6. Sorting student by grade descending / ascending……………………………………
        1. 7 Exit the program……………………………………………..……………………………
  • between the written algorithm and the code variant…………………………………………….. III. Examine the implementation of an algorithm in a suitable language. Evaluate the relationship
      1. Test Case………………………………………………………………………………………
      1. Evaluate………………………………………………………………………………………..
  • REFERENCES………………………………………………………………………………………

Introduction Algorithms are used for calculation, data processing, and automated reasoning. Whether you are aware of it or not, algorithms are becoming a ubiquitous part because computers are playing increasingly important roles in so many aspects of our lives. This assignment will provide my understanding about an overview about algorithm, using algorithms and C# programming language to solve a small problem. I. Provide a definition of what an algorithm is and outline the process in building an application. 1. Overview about Algorithm 1.1. Definition of algorithms An algorithm is a specific set of instructions for carrying out a procedure or solving a problem, usually with the requirement that the procedure terminate at some point. Specific algorithms sometimes also go by the name method, procedure, or technique. The word "algorithm" is a distortion of al-Khwarizmi, a Persian mathematician who wrote an influential treatise about algebraic methods. The process of applying an algorithm to an input to obtain an output is called a computation. 1 .2. How do computer algorithms work? Computer algorithms work via input and output. They take the input and apply each step of the algorithm to that information to generate an output. You can easily visualize algorithms as a flowchart. The input leads to steps and questions that need handling in order. When each section of the flowchart is completed, the generated result is the output.

Flowchart of find the search number algorithm 2. Characteristics algorithm

  • Input: These are the value can be process by the algorithm, there could be multiple input depend on the program.
  • Output: The output is the data resulting from the computation (intended result). An algorithm should have 1 or more outputs, and should match the desired output.
  • Variable used in the program: o Int stdNums: number of student info to store in the array o Int array stdId: store list of student ID in an array o Int array grade: store list of student grade in an array o Int search: number the user entered to check if it matchs with student ID o Int count: count the number of student with an match ID
  • Finiteness − Algorithms must terminate after a finite number of steps.
  • Feasibility − Should be feasible with the available resources.
  • Independent − An algorithm should have step-by-step directions, which should be independent of any programming code. 2.1. How problem is solved To implement this algorithm, I use Visual Studio to make a console app with C# programming language. The program can take a list of student’s information and the search student’s ID as input and output the information of the search student ID.

Explanation:

  • First, the application will ask for how many students user want to add and read that value, save it to an integer value stdNums. Then declare and int array studentId and float array grade to store student information.
  • Secondly, the application will run a for loop base on the number of students added and takes student ID and grade input from user, add them to the two arrays created above.
  • Next, the application will ask the ID of the student the user want to search for and read that value. An integer also creates to count the number of students with match ID.
  • Finally, the application run the same loop as above to check if the student ID is matched. If the condition is met it prints out the student information, otherwise it will print "Student ID is not exist."

Screenshot of the program running:

Stage 2: Defining Requirements Once the requirement analysis is done the next step is to clearly define and document the product requirements and get them approved from the customer or the market analysts. This is done through an SRS (Software Requirement Specification) document which consists of all the product requirements to be designed and developed during the project life cycle. Stage 3: Designing the Product Architecture SRS is the reference for product architects to come out with the best architecture for the product to be developed. Based on the requirements specified in SRS, usually more than one design approach for the product architecture is proposed and documented in a DDS - Design Document Specification. This DDS is reviewed by all the important stakeholders and based on various parameters as risk assessment, product robustness, design modularity, budget and time constraints, the best design approach is selected for the product. A design approach clearly defines all the architectural modules of the product along with its communication and data flow representation with the external and third-party modules (if any). The internal design of all the modules of the proposed architecture should be clearly defined with the minutest of the details in DDS. Stage 4: Building or Developing the Product In this stage of SDLC the actual development starts and the product is built. The programming code is generated as per DDS during this stage. If the design is performed in a detailed and organized manner, code generation can be accomplished without much hassle. Developers must follow the coding guidelines defined by their organization and programming tools like compilers, interpreters, debuggers, etc. are used to generate the code. Different high-level programming languages such as C, C++, Pascal, Java and PHP are used for coding. The programming language is chosen with respect to the type of software being developed. Stage 5: Testing the Product This stage is usually a subset of all the stages as in the modern SDLC models, the testing activities are mostly involved in all the stages of SDLC. However, this stage refers to the testing only stage of the product where product defects are reported, tracked, fixed and retested, until the product reaches the quality standards defined in the SRS.

Stage 6: Deployment in the Market and Maintenance Once the product is tested and ready to be deployed it is released formally in the appropriate market. Sometimes product deployment happens in stages as per the business strategy of that organization. The product may first be released in a limited segment and tested in the real business environment (UAT- User acceptance testing). Then based on the feedback, the product may be released as it is or with suggested enhancements in the targeting market segment. After the product is released in the market, its maintenance is done for the existing customer base. 3.2. Represent a small and simple problem In order to present more about algorithm and its details. I will upgrade the application above to solve a small and simple problem as follows: A teacher wants to manage average grade of students who attend his class. He needs to adding student into student list, print out all the student’s information entered, prints out the student with the highest/lowest average grade, search student’s information through student ID and remove student from the list. Furthermore, the program will have a main selection menu to select through various option. 3.3. Analyze the problem With the help of Visual Studio, I can create an console app with C# programming language that will be able to solve the teacher problem. Additionally, the program will include the usage of various libraries, variables, loop statements, conditional statements. 3.4. Activity Diagrams

II. Determine the steps taken from writing code to execution. 1. Source code 1.1. Create Student class in file Student.cs This class include variable:

  • String stuId: store student Id
  • String name: store student name
  • Int age: store student age
  • Email: store student email
  • Grade: store student average grade Each variable has getter and setter, constructor for easy access the information from the outside of the class.

Function outputInfo(): This function uses to simply display the student information 1.2. Create Classroom class in file Classroom.cs Create student list and set it to public to grant access for others files. Next I create function AddStudent() to add student class to the list.

Lastly, a function RemoveStudent(int rmv); This will simply find a student’s information at the variable rmv position in the array list and remove it. 1.3. File Program.cs 1.3.1 Declare variable and array 1.3.2. Select menu function The menu function has only one job is to print out the menu layout for the application. I have created a do – while loop and put menu function and the switch – case statement for the user to check the menu again after finishing a function.

1.3.3. Input student’s information Case 1: The function job is to allow the user entered the student’s information and store them in each previously declared array. Firstly, it will ask the user to input the number of students that the user want to store information in and store it in variable stuNums. Next the program will keep asking the user to input the same amount of student’s information using the “for” loop. The information which the user entered will be store in the accordingly array. 1.3.4. Print student’s information I create a function passing List through parameter and by using the “foreach” loop this function can display the student’s information being store in the array.