



















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















































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 Ngo Tuan Anh Student ID GCH Class GCH1101 Assessor name 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 D
❒ Summative Feedback: ❒ Resubmission Feedback: Grade: Assessor Signature: Date: Lecturer Signature:
I. Introduction
1. Algorithm a. Definition An algorithm is a finite series of exact instructions used to solve a class of particular problems or carry out a calculation in mathematics and computer science (Anon., 2020). In its broadest meaning, is a set of instructions that guide a computer on how to turn a collection of world facts into helpful information. The information that is helpful to humans, robots, or other algorithms is derived from the facts, which are data. The process of doing laundry, the way we solve a long division problem, the ingredients for making a cake, and the operation of a search engine are all instances of algorithms. What might a list of instructions for baking a cake look like?
The capacity to identify precise methods to solve a problem, or algorithmic thinking, is essential in many different domains, including machine learning and artificial intelligence. We constantly employ algorithms and algorithmic thinking, even if we're not aware of it. People that use algorithmic thinking can dissect issues and visualize fixes as distinct processes. They must use structured thinking and reasoning skills to comprehend and use an algorithm. e. Object-oriented language (OOP) i. General concepts A programming paradigm called "Object-oriented programming" (OOP) is founded on the idea that "objects" can contain both code and data (Kindler & Krivy, 2011). Data can be found in the form of fields (sometimes called attributes or properties), while code can be found in the form of procedures (often known as methods). Objects frequently have procedures (or methods) connected to them that provide access to and control over the object's data fields. In this particular brand of OOP, the present object is typically identified by a special name like this or self. Computer programs are created using OOP by constructing them from objects that communicate with one another. For example, below is an illustration of an employee record where each person can be seen as an "object." Every employee has a name, age, and job title, so they can all be referred to as their "properties."
an object's blueprint. It outlines the object's characteristics, methods, and other features.
4. Inheritance and Composition The act of permitting one object to produce another is known as inheritance. The attributes, methods, and other features of another object can essentially be "inherited" by another object. The act of combining different objects to produce a brand-new, original object is known as composition. Programmers can essentially reuse the elements that are specific to other objects to construct new, original objects. iii. Compare to POP Procedural programming is a programming paradigm that uses a linear or top-down approach. It relies on procedures or subroutines to perform computations. (Techopedia 2015). In simpler words, programmers write a series of instructions involving the progress of splitting up lines of codes into a small set of variables, data structures, and subroutines. OOP POP Basic Definition OOP is object- oriented. POP is structure or procedure-oriented. Program Division The program is divided into objects. The program is divided into functions. Approach Bottom-Up approach Top-down approach Data Control Data in each object is controlled on its own. Every function has different data, so
there’s no control over it. Entity Linkage Object functions are linked through message passing. Parts of a program are linked through parameter passing. Expansion Adding new data and functions is easy. Expanding data and function is not easy. Inheritance Inheritance is supported in three modes: public, private & protected. Inheritance is not supported. Access control Access control is done with access modifiers. No access modifiers supported. Data Hiding Data can be hidden using Encapsulation. No data hiding. Data is accessible globally. Polymorphism Overloading functions, constructors, and operators are done. Overloading is not possible. Virtual classes or functions The virtual function appears during inheritance. No virtual classes or functions. Code Reusability The existing code can be reused. No code reusability.
2. Problem statement a. Business problem
and accounts (containing the username, and password), so object-oriented programming is a fit solution for creating and accessing the object details. Furthermore, there are various types of data such as student name (type string), student Id (type Integer), and grades (type float), that are needed to be stored and accessed through different methods. ÏFurthermore, there are various types of data such as student name (type string), student Id (type integer), and grades (type float) ... that need to be stored and accessed through different methods. Using global variables to store this information could help to reduce the duplication inside each function and all of the functions can access these variables. For example, the function accepts will receive the input from the teacher and store the student's records inside a list, and then the function display will get the data from the student's list, which is global, to display the records. To provide an interface for the teacher to choose the option to execute the program, a do-while loop statement and multiple print functions are necessary. Hence, to conclude, procedural programming is a well-suited solution for breaking down the programs into different sub-routines (suitable for different needed features that the Maths teacher wants), storing, managing variable sets to use globally through the program and loop and conditional statements for validation, display and get the inputs. II. Analysis and Design
1. Analysis a. Data Types No Name Type Purpose 1 Student Store student’s id, name, date of birth, grades, class 2 Account Store account’s username and password 3 userChoice String Store user’s menu choice
4 _students List
d. Loop statement Specific lines of code will be run a specified number of times inside this statement. There are three main statements inside a for loop: counter initialization, condition check, and increment or decrement operation to assign a new value to the counter variable. As the program will interact with each student one by one in the array, so a loop statement is necessary for this program.
b. WBS Is a concept to describe the division of work objects to make work content transparent, and identify necessary tasks to achieve goals. (Cohen 2018) Through the main needed functions, the program has the following parts: