Docsity

ASM 1 , subject 1618, Slides of Computer Science

Toggle sidebar
bg1
Page | 1
Higher National in Computing
Unit 1: Programming
ASSIGNMENT 1
Name: Dong Sy Nhat Thanh
ID: GCS210033
Class: GCS1003A
Subject code: 1618
Assignment due: Assignment submitted:
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14

Partial preview of the text

Download ASM 1 , subject 1618 and more Slides Computer Science in PDF only on Docsity!

Higher National in Computing

Unit 1: Programming

ASSIGNMENT 1

Name: Dong Sy Nhat Thanh

ID: GCS

Class: GCS1003A

Subject code: 1618

Assignment due: Assignment submitted:

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 Dong Sy Nhat Thanh Student ID GCS Class Assessor name Nguyen Tuan Dang 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

Assignment Brief 1 (RQF)

Higher National Certificate/Diploma in Computing

Student Name/ID Number: Unit Number and Title: Unit 1: Programming Academic Year: 2021 – 2022 Unit Assessor: Vinh Hoang Assignment Title: Problem solving with algorithms Issue Date: 01 April 2021 Submission Date: Internal Verifier Name: Date: Submission Format:

Format: ● The submission is in the form of an individual written report. This should be written in a concise, formal business style using single spacing and font size 12. You are required to make use of headings, paragraphs and subsections as appropriate, and all work must be supported with research and referenced using the Harvard referencing system. Please also provide a bibliography using the Harvard referencing system. Submission ● Students are compulsory to submit the assignment in due date and in a way requested by the Tutor. ● The form of submission will be a soft copy posted on http://cms.greenwich.edu.vn/. ● Remember to convert the word file into PDF file before the submission on CMS. Note: ● The individual Assignment must be your own work, and not copied by or from another student. ● If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you must reference your sources, using the Harvard style. ● Make sure that you understand and follow the guidelines to avoid plagiarism. Failure to comply this requirement will result in a failed assignment. Unit Learning Outcomes: LO1 Define basic algorithms to carry out an operation and outline the process of programming an application Assignment Brief and Guidance:

Table of Contents

  • Task 1 – State simple business problems to be solved (P1)
      1. Introduction to computer programming language
      1. Algorithm..............................................................................................................................................
    • 2.1. Definition............................................................................................................................................
    • 2.2. Ways to write algorithms
    • 2.3. What is it used for?
  • Task 2 – Analyse the problem and design the solutions by the use of suitable methods (P1)
      1. Business program
      1. Flowchart
  • Task 3 – Demonstrate the compilation and Running of a program (P1 – M1)
      1. Source code
      1. Run the program
  • written by a specific programming language (D1) Task 4 – Evaluate how the problem is solved from the designed algorithm to the execution program
    • REFERENCES

Task 1 – State simple business problems to be solved (P1)

  1. Introduction to computer programming language: A programming language is a formal language that contains a set of generated instructions different output types. Programming languages are used in computer programming to implement algorithm. computer programming language, one of several languages that execute directly when referred to as a machine in a computer manufacturer-specific numerical form language, after a simple substitution process, when expressed in the appropriate assembly language or after translation from an "advanced" language. Programming languages are also divided into two types, which are "high-level" programming languages and "lowlevel" programming languages.

  2. Algorithm: 2.1. Definition: ❖ In a nutshell, algorithms are formulas for programmers to apply. It includes all you need to know about what to do, how to use it, and also how your computer will help you. In computer language, these formulas are referred to as procedures. The computer completes the tasks using the specified input and procedures, then returns the results to the user. The better the formulas are, the more effective the program is. ❖ It's important to keep in mind that computer algorithms are simple, they must have a clear beginning and end, along with all steps necessary to complete their tasks. There are no commands that aren't required for the current actions. 2.2. Ways to write algorithms: Algorithms for computers can be written in a variety of ways. A flowchart, which is a graph that shows the phases and direction of your algorithm from start to finish, is commonly used by programmers. Next, pseudocode, a semi-linguistic method of describing the steps required in an algorithm that omits superfluous details such as subroutine elimination, variable declarations, and system-specific code, may be used by other programmers. 2.3. What is it used for?

  1. Flowchart I'll start by drawing a diagram for the business plan that the task requires. This flowchart will have a clear start and finish point; it will function as a summary table for the entire program, it will be rather short and will simply show the program's essential actions. The following lines, in my opinion, are the features that this program includes:
  • Based on the customer's serial number and the amount of things purchased, calculate and print the cost.
  • If the incorrect serial number is entered, the screen shows an alert before returning to the serial number input display.
  • When the number of commodities in the bill exceeds a certain threshold, the program automatically drops the price. I was able to orient the software and begin developing it after creating the feature list. Figure 1: Enter serial numbers

Figure 2: Identify the products and print the price Figure 3: Discount on products

❖Then I add further commands to the software so that it prints a few more lines for consumers to enter the serial number and quantity of the product they want to purchase. This is also the place for the program to receive information from the customer and start calculating and finally printing the price. Figure 6: Enter serial number and quantity ❖ I also use a while statement to tell customers when they entered the wrong serial number. For example, the product I show here is 6, however if they type a number higher than 6, it will print "This product does not exist" and then show an additional line below it that says "re-enter here: ". Figure 7: Error Message ❖ I used an If-else expression to create a product discount. In this scenario, I believe if- else is the best option. When the quantity of a product reaches 5, the software reduces the price for the customer by 2/5, and if the quantity does not exceed 5, the program prints the original price. The else statement is used to apply the If statement to a different product. To get a better understanding, take a look at the images below.

Figure 8: Discount product Figure 9: Discount product

And here is the program when it has a discount: Figure 12: Has a discount And here is the program that notifies customers when they enter the wrong serial number: Figure 13: Enter wrong serial number

Task 4 - Evaluate how the problem is solved from the designed algorithm to the execution program written by a specific programming language (D1) I think this program can solve the problem but not in a really perfect way and can be applied in a real store. And here are some problems of the program that I found, I think it would be a great program if these problems were fixed:

  • The program only accepts integers and does not accept any other characters. For example, when you enter the following characters into the program: "6.5, 5.3, 1.2, a, b, c, +, - , $" it will immediately fail instead of displaying the words "This product is doesn’t exist".
  • Customers can’t enter the serial number of multiple products at the same time in the order selection line. Because the code that I write can only get 1 choice. As I said, this program cannot be applied to a real store yet, because this problem can cause inconvenience to customers.
  1. Wikipedia Contributors (2019). Integrated development environment. [online] Wikipedia. Available at: https://en.wikipedia.org/wiki/Integrated_development_environment.