Docsity

Programing_ Assignment 1_1st_, Exercises of Information Technology

Toggle sidebar
bg1
0
ASSIGNMENT 1 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Unit 1: Programming
Submission date
1/6
Date Received 1st submission
Re-submission Date
Date Received 2nd submission
Student Name
TRUONG VAN DIEP
Student ID
BH00666
Class
SE06203
Assessor name
NGUYEN TRONG HUNG
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
DIEP
Grading grid
P1
M1
D1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Programing_ Assignment 1_1st_ and more Exercises Information Technology 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 1 / 6 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name TRUONG VAN DIEP Student ID BH Class SE06203 Assessor name NGUYEN TRONG HUNG 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 DIEP Grading grid P1 M1 D

❒ Summative Feedback: ❒ Resubmission Feedback: Grade: Assessor Signature: Date: Lecturer Signature:

I. State your simple business problems to be solved.

1. Overview about algorithm a, What is Algorithm?

  • Algorithm is defined as "a procedure or set of rules to be followed in computations or other problem- solving processes.” Consequently, an algorithm is a set of rules or instructions that govern how a work is to be conducted step by step in order to achieve the desired results. The developed algorithms are language-independent, which means they are essentially simple instructions that may be implemented in any language and provide the same result. Algorithm 1
  • The developed algorithms are language-independent, which means they are essentially simple instructions that may be implemented in any language and provide the same result. b, Characteristics of Algorithm.
  • Some instructions must have the following features to be considered an algorithm: ❖ Clear and Unambiguous : The algorithm should be explicit and clear. Each of its phases should be obvious in every way and should only lead to one meaning. ❖ Well-Defined Inputs : If an algorithm states it needs inputs, those inputs should be well-defined.

❖ Well-Defined Outputs: The algorithm must explicitly specify and be well-defined what output will be produced. ❖ Finiteness : The method must be finite, which means it must not end up in infinite loops or something similar. ❖ Feasible : The method must be basic, general, and practical enough to be run with the given resources. It must not include any futuristic technologies or anything else. ❖ Language Independent : The planned algorithm must be language-independent, i.e. it must be merely simple instructions that may be implemented in any language and still provide the intended results

  • To find sum of two numbers: Algorithm 1. Start 2. Read a, b 3. c = a + b 4. Print or display c 5. Stop

2. Represent a small and simple problem.

  • To know more about algorithms in programming, I will present a small and simple business problem, which is to sort students' scores by student's last name. This is a problem that teachers often face when classifying students in the class. Example: How bubble sort algorithm works First Pass : The largest element is placed in its correct position, i.e., the end of the array. Bubble sort 1 Second Pass : Place the second largest element at correct position. Bubble sort 2

Third Pass: Place the remaining two elements at their correct positions. Bubble sort 3 II. Analyze the problem and design the solutions by the use of suitable methods. Business Problem: Automated Purchase Order System

  • The current system for creating and managing purchase orders at our company is manual and time- consuming. We are looking for a solution that will automate the process, reduce errors, and save time.
  • Application Requirements: ❖ Enable users to create new purchase orders. ❖ Allow users to view and edit existing purchase orders. ❖ Generate a unique purchase order number for each new order. ❖ Ensure all required fields are filled out before the order can be submitted. ❖ Allow users to search for purchase orders by number, vendor, or date range. ❖ Provide notifications and alerts for overdue or pending orders. ❖ Allow for tracking and logging of order history and changes. ❖ Integrate with our existing inventory management system.
  • Design:
  • Users log in or sign up to the system
  • The system displays a dashboard with options to search for an order, create an order or add to cart and view existing orders.
  • If the user selects "Search for Orders": ❖ User can search for orders by purchase order number, vendor name, or date range

Flowchart 1

  • Dashboard: ❖ Search for Orders. ❖ Create New Purchase Order or Add to cart. ❖ View Existing Orders.
  • Search for Orders: ❖ Search by PO Number, Vendor Name, or Date Range
  • Create New Purchase Order: ❖ Generate PO Number. ❖ Fill out required fields. ❖ Validate fields. ❖ Add to database. ❖ Display Success Message. ❖ Display Error Message.
  • Add to Cart

❖ Generate PO number ❖ Add to database

  • View Existing Orders: ❖ Display List of Orders ❖ Select Order to View ❖ Display Order Details
  • Notifications and Alerts: ❖ Overdue or Pending Orders
  • Order History: ❖ Track View and Changes Integration with Inventory Management System: ❖ Track and Update Inventory III. Explain briefly what is Software Development Life Cycle. The Software Development Life Cycle (SDLC) is a technique for developing high-quality software that includes well defined procedures. In particular, the SOLC technique focuses on the following phases of software development: ❖ Analysis of requirements ❖ Planning ❖ Architectural design, for example, is a type of software design. ❖ The creation of software ❖ Testing ❖ Deployment 1 ,What is Software Development Life Cycle? A process followed in software projects is SDLC. Each phase of SDLC produces deliverables required by the next phase in the life cycle. Requirements are translated into design. Code is produced according to the design. Testing should be done on a developed product based on the requirement. The deployment should be done once the testing is completed. It aims to produce a high-quality system that meets or exceeds customer expectations, works effectively and efficiently in the current and planned information technology infrastructure, and is inexpensive to maintain and cost-effective to enhance.

switch (op) { case '+': result = num1 + num2; Console.WriteLine("Result: " + result); break; case '-': result = num1 - num2; Console.WriteLine("Result: " + result); break; case '*': result = num1 * num2; Console.WriteLine("Result: " + result); break; case '/': if (num2 == 0) { Console.WriteLine("Cannot divide by zero!"); } else { result = num1 / num2; Console.WriteLine("Result: " + result); } break; default: Console.WriteLine("Invalid operator!"); break; } } } } Explanation : ❖ The code starts with the declaration of the namespace CalculatorApp. The class Calculator contains the code for the calculator. ❖ The Main method is the entry point of the program. It declares three variables num1, num2, and result of type double and a variable op of type char. ❖ The program then prints a message to the console asking the user to enter the first number, reads the input from the console, and stores it in the num1 variable. Similarly, it asks the user to enter the second number, reads the input, and stores it in the num2 variable. It then asks the user to enter the operator and stores it in the op variable. ❖ The program then uses a switch statement to evaluate the operator entered by the user. If the operator is +, - , *, or /, it performs the corresponding operation and stores the result in the result

variable. It then prints the result to the console. If the user enters an invalid operator, the program prints an error message. ❖ If the user tries to divide by zero, the program prints an error message.

IV. Evaluate how the problem is solved from the designed algorithm to the execution

program written by a specific programming language.

  • The problem of a simple calculator with basic arithmetic operations is solved by using a switch statement in C#. The algorithm is designed to prompt the user for two numbers and an operator, and then perform the appropriate arithmetic operation based on the operator input. The program then displays the result of the calculation.
  • To evaluate the solution of the problem, we can test the program with various inputs and verify that it produces the expected outputs. Here is a test plan with test cases:
  • Test: Case1 : Addition of two positive integers Case 1
  • I. State your simple business problems to be solved. - 1. Overview about algorithm - a, What is Algorithm?............................................................................................................................................ - b, Characteristics of Algorithm. - c, Types of Algorithms.
      1. Represent a small and simple problem.
  • Purchase Order System II. Analyze the problem and design the solutions by the use of suitable methods. Business Problem: Automated
  • III. Explain briefly what is Software Development Life Cycle.
    • 1 ,What is Software Development Life Cycle?
    • 2 , Example of C# source code for a simple calculator :
  • Algorithm Table of figures
  • Algorithm is clear from input to output
  • Bubble sort
  • Bubble sort
  • Bubble sort
  • Flowchart
  • Case
  • Case
  • Case
  • Case
  • Case