0% found this document useful (0 votes)
25 views

Unit 1 - Programming

The document discusses the process of writing code, including understanding the software purpose, designing the code, writing and compiling the code, debugging, and maintenance. It also covers algorithms, the difference between compiling and running a program, and provides examples of algorithms and code in C#.

Uploaded by

haihg123zzz
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Unit 1 - Programming

The document discusses the process of writing code, including understanding the software purpose, designing the code, writing and compiling the code, debugging, and maintenance. It also covers algorithms, the difference between compiling and running a program, and provides examples of algorithms and code in C#.

Uploaded by

haihg123zzz
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

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 Hoang Duc Hai Student ID BH01765

Class SE6304 Assessor name Dinh Van Dong

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 Hoang Duc Hai

Grading grid

P1 P2 M1 D1
 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date:


Lecturer Signature:
Table of Contents

I. Introduction
1. What is programming?
2. Programming as collaboration
3. Conclusion
II. Algorithm
1. What is algorithm?
2. Example about algorithm
3. Example about algorithm in c#
4. Flow chart
III. Program
1. Compiling a program
2. Running a program
3. What is the difference between compiling a program and running a program?
IV. Analyze the process of writing code.
1. Awareness of the software solution purpose
2. Designing the code
3. Writing the code
4. Source code compilation
5. Run the executable code
6. Program debugging
7. Code maintenance
V. References
Introduction

What is programming?

Programming refers to a technological process for telling a computer which tasks to perform in order to
solve problems. You can think of programming as a collaboration between humans and computers, in
which humans create instructions for a computer to follow (code) in a language computer can understand.

Programming enables so many things in our lives. Here are some examples:
• When you browse a website to find information, contact a service provider, or make a purchase,
programming allows you to interact with the site’s on-page elements, such as sign-up or purchase
buttons, contact forms, and drop-down menus.
• The programming behind a mobile app can make it possible for you to order food, book a rideshare
service, track your fitness, access media, and more with ease.
• Programming helps businesses operate more efficiently through different software for file storage
and automation and video conferencing tools to connect people globally, among other things.
• Space exploration is made possible through programming.
Programming as collaboration

When we give instructions to a computer through code, we are, in our own way, communicating with the
computer. But since computers are built differently than we are, we have to translate our instructions in a
way that computers will understand.

Computers interpret instructions in a very literal manner, so we have to be very specific in how we
program them. Think about instructing someone to walk. If you start by telling them, “Put your foot in
front of yourself,” do they know what a foot is? Or what front means? (and now we understand why it’s
taken so long to develop bipedal robots…). In coding, that could mean making sure that small things like
punctuation and spelling are correct. Many tears have been shed over a missing semicolon (;) a symbol
that a lot of programming languages use to denote the end of a line.

But rather than think of this as a boss-employee relationship, it’s more helpful to think about our
relationship with computers as a collaboration.

The computer is just one (particularly powerful) tool in a long list of tools that humans have used to
extend and augment their abilities.
As mentioned before, computers are very good at certain things and well, not so good at others. But here’s
the good news: the things that computers are good at, humans suck at, and the things that computers suck
at, humans are good at! Look at this handy table:

Conclusion

As programming becomes a larger part of our lives, it’s vital that everyone understands what
programming is and how it can be used. Programming is important to our careers, but it also plays a key
role in how we participate in politics, how we buy things, and how we stay in touch with one another.

Learning to code is an exciting journey. Whether your goal is to build a mobile app, search a database, or
program a robot, coding is a skill that will take you far in life. Just remember — computers are tools.
While learning to program may initially be frustrating, if you choose to stick with it, you’ll be able to
make some brilliant things.

II. Algorithm

1. What is an algorithm?
An algorithm is a procedure used for solving a problem or performing a computation. Algorithms act as an
exact list of instructions that conduct specified actions step by step in either hardware- or software-
based routines.

Algorithms are widely used throughout all areas of IT. In mathematics, computer programming and
computer science, an algorithm usually refers to a small procedure that solves a recurrent problem.
Algorithms are also used as specifications for performing data processing and play a major role in
automated systems.

An algorithm could be used for sorting sets of numbers or for more complicated tasks, such as
recommending user content on social media. Algorithms typically start with initial input and instructions
that describe a specific computation. When the computation is executed, the process produces an output.

2. Here is an example about algorithm:

1. Slather your condiments on the bottom slice of bread.


2. Add the densest vegetables, like pickles, followed by the lettuce and then the
tomato.
3. Add the cheese.
4. Add the meat.
5. Spread another layer of condiments on the top slice of bread.

Here is an example about an algorithm in C# and explanation.

And this is flowing chart about it:


First, I will input a and b from keyboard.

And I will give max = 0.

After that, it will compare a and b.

- a < b, if it true then max = b.


- If the a > b then max = a.
VI. Program

Compiling a program

Compiling is the transformation from Source Code (human readable) into machine code (computer
executable). A compiler is a program. A compiler takes the recipe (code) for a new program (written in a
high-level language) and transforms this Code into a new language (Machine Language) that can be
understood by the computer itself. This "machine language" is difficult to impossible for humans to read
and understand (much less debug and maintain), thus the need for "high level languages" such as C.

Running a program

Running a computer program refers to the execution of the instructions in the program by the computer.
When you run or execute a program, the operating system plays a key role as it provides the program with
access to the resources of the computer in a controlled fashion. The following Slideshow describes in
more detail the typical sequence of events that occur when a program is run and how the program, the
operating system, and the hardware of the computer interact.

What is the difference between compiling a program and running a program?

"Run" is what you think of when you want to run the code. The code runs, does whatever you
programmed it to do, and produces some output.

C# however is a compiled language. That means you can't just run your code. You have to compile it first.
Compiling means taking your source code (the .java files) which are just text and turning them into
something that can be run (.class files). Once the code is compiled, you can then run the compiled code.

So, it's a two-step process: compile, then run.

You don't always have to do both though, for example, certain types of errors in your code will cause the
compilation to fail. This can be things like having the wrong syntax (like missing a bracket or semicolon),
trying to use a variable that doesn't exist. Using the wrong type, and more. In these cases, you never get to
run because your code doesn't even compile. Errors that make the code not compile are called "compile-
time errors" or just "compile errors".

Sometimes you compile but not run on purpose as well. When you are done with the program, and you
want to distribute it, you compile the program so you can send out the compiled code. There's no need to
run in this case because you just want to get the compiled version to send out. You also might want to just
compile to see that it can compile, but not want to run the code. This is useful because it lets you know
some possible problems in your code and is much faster to just check the compile than to run the code as
well.
On the other hand, if the code is already compiled, and you just want to run it, you don't need to compile
again and can just run the compiled code. Be careful of this though, it's easy to make some changes, then
forget to compile before running. If you do this you will run the old version of the code that you compiled
before, and it won't have any of the changes you made. If you are trying to track down a bug and your
changes don't seem to be helping, make sure you did another compile and are not running an old version
of the code.

IV. Analyze the process of writing code.


1. Awareness of the software solution purpose

Every software solution starts with an idea. So, to choose suitable solutions and write a program code, the
coder needs to understand clearly the root of problems and fix it completely perfectly.

2. Designing the code

Before diving into writing a code for a program, coder need to find out the problem about algorithms and
solve the problem about it, which include its functions, the connections between them.

3. Writing the code

After the previous two stages are completed and approved by the project manager and the client, the next
stage is writing the code. This step acquires coder to base on algorithms to write code.

4. Source code compilation

After the source code is completely ready. The next one is source code compilation, in which details
depend on the programming environment. As a result of this step, developers get a unified program code
that can be easily opened on their computers and be usable. This stage also helps define the code bugs and
errors that prevent the code from being converted into an executable file.

5. Run the executable code.

As a result of this step, developers get a unified program code that can be easily opened on their
computers and usable. This stage also helps define the code bugs and errors that prevent the code to be
converted into an executable file.

6. Program debugging

After the program code is edited, it is ready to be tested to reveal any possible bugs meaning system
errors. It is totally okay to have such issues, as code includes lots of tiny details, and such cases only
enable learning code writing deeper. The variety of possible errors is broad, and you can find bugs in
different parts of the code. Surely, the compiling step entails debugging, but it doesn’t catch all system
mistakes, that is why engineers double-check the code correctness.

7. Code maintenance

Any type of software solution, including its code, requires constant maintenance and regular upgrades.
With years, technologies, and programming languages change, so the program code can become
irrelevant and outdated. the completed software system can be integrated with new features. which also
requires writing code for new features according to the flow we described above.

Explanation of stimulation program

Part 1:

In part 1: I will input 4 arrays which are array for number of people, Customer Type, Water Meter Last
Month, Water Meter This month. After that I will input 4 array from keyboard.
Part 2: Input array from keyboard

Part 3: Print the information which is Customer, name, last month , this month
Part 4: I use the for statement and if statement sort the customer by water bill money.

Part 5: This step is also sort the customer by water bill money.
V. References

Codecademy (no date) What is programming?, Codecademy. Available at:


https://www.codecademy.com/article/what-is-programming (Accessed: 16 October 2023).
Gillis, A.S. (2023) What is an algorithm?: TechTarget, WhatIs.com. Available at:
https://www.techtarget.com/whatis/definition/algorithm#:~:text=An%20algorithm%20is%20a%20pr
ocedure,%2D%20or%20software%2Dbased%20routines. (Accessed: 16 October 2023).

Difference between compile and run? (no date) Reddit. Available at:
https://www.reddit.com/r/javahelp/comments/8pwnx4/difference_between_compile_and_run/?rdt=4
2374 (Accessed: 16 October 2023).

Germain, H.J. de St. (no date) Compiling, Programming - Compiling C Programs. Available at:
https://users.cs.utah.edu/~germain/PPS/Topics/C_Language/compiling_C_programs.html#:~:text=C
ompiling%20is%20the%20transformation%20from,A%20compiler%20is%20a%20program.
(Accessed: 16 October 2023).

Group, R.S. (2022) How to write computer code in 7 steps?, Red Sky Digital. Available at:
https://redskydigital.com/how-to-write-computer-code-in-7-steps/ (Accessed: 16 October 2023).

You might also like