Professional Documents
Culture Documents
Asg1 Le Thanh Hoang
Asg1 Le Thanh Hoang
Unit 1: Programming
ASSIGNMENT 1
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: ❒ Resubmission Feedback:
Academic Year
Unit Tutor
Submission Format:
Format: The submission is in the form of an individual written report and a presentation. 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 Tutors. The form of submission will be a soft copy in PDF posted on corresponding
course of http://cms.greenwich.edu.vn/
Note: The Assignment must be your own work, and not copied by or from another student or from
books etc. 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 know how to reference
properly, and that understand the guidelines on plagiarism. If you do not, you definitely get fail
Assignment Brief and Guidance:
Scenario: You have applied for a post as a trainee with a software development company and have been invited for an
interview. You have been asked to demonstrate your problem solving and basic programming skills. To do this you have to
prepare a report on using algorithms to solve problems.
You need to explain, using examples, how algorithms are used to solve simple business problems and the steps needed to be
followed to produce a working program solution. You should make clear your assumption about your program. The problems
to be solved will involve basic procedural programming instructions - sequence instructions (input, output and assignment
statements), loops, conditional statements. Problems should be analysed and designed by the use of flowchart and
demonstrated by the use of modules (procedures) using a menu based program.
Tasks:
1. State your simple business problems to be solved.
2. Analyse the problem and design the solutions by the use of suitable methods.
3. Demonstrate the compilation and running of a menu-based program
4. Evaluate how the problem is solved from the designed algorithm to the execution program written by a specific
programming language.
You also need to do a presentation of your work (it should be summary of your report).
P1. Provide a definition of what an algorithm is and outline the process in building an application.
Algorithm
1. Definition
2. Usage
Different applications for algorithms are available for any task that can be solved with mental energy
(math, storage of information, adaptation):
- Figuring out new ways and more efficient ways to solve a problem
3. Example
In our example we will program an algorithm to print out an array that has been setup by the user
previously.
Page |1
Integer input:
Sorter:
Step 1: START
Step 4: Read r
Page |2
Step 7.1.1: Print out “Enter integer at “ w+1 “ and column “ q+1
Building an application
We will build our application using visual studio code and we will code it in c# and will use buble
sorting.
Example:
Our example will involve the development of a program that can remember inputed integers and
store them in an array.
Example:
Page |3
Our application will remember an array of integers for us and will print them back out when we ask.
Example:
The user interface is composed of a input space for the number of rows, columns and the integer at a given
sport in the array.
The program will then print everything back out in a table form.
Right here we provide details the details of implementing all the different features of the application.
Example:
Test 1:
Page |4
Test 2:
Test 3:
Page |5
The numbers are in order
Here, we release the project and start commercializing it. We also start doing maintenance for the customer.
Source code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Array_Printer
{
class Program
{
static void Main(string[] args)
{
int r, c, w, q, inp;
Console.Write("Enter number of rows: ");
r = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter number of columns: ");
c = Convert.ToInt32(Console.ReadLine());
int[,] a = new int[r, c];
for(w=0; w <= r-1; w++)
{
for (q = 0; q <= c-1; q++)
{
Console.Write("Enter integer at row ");
Console.Write(w + 1);
Console.Write(" and column ");
Console.Write(q + 1);
Console.WriteLine();
a[w,q] = Convert.ToInt32(Console.ReadLine());
}
}
Console.WriteLine("The array");
for(w=0;w<=r-1;w++)
{
for (q=0;q<=c-1;q++)
{
Console.Write(a[w, q] + " ");
}
Console.WriteLine();
}
Console.WriteLine("Pres any key to continue...");
Console.ReadKey();
}
}
}
Page |6
REFERENCES
Page |7