1. Trang chủ
  2. » Luận Văn - Báo Cáo

Assignment of PROGRAMMING (1618)

50 15 1

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Assignment of PROGRAMMING (1618)
Tác giả Vu Thanh Truong
Trường học University of Computing
Chuyên ngành Programming
Thể loại assignment
Năm xuất bản 2023
Thành phố Unknown
Định dạng
Số trang 50
Dung lượng 1,44 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Cấu trúc

  • I. General properties and limitations of the algorithm (10)
    • 1. Algorithm definition (10)
    • 2. Some algorithms (11)
    • 3. Examples of algorithms (13)
  • II. Feature algorithm (14)
  • III. Software Development Life Cycle (SDLC) (16)
    • 1. Definition (16)
  • IV. Represents a small and simple problem (18)
  • V. Problem solving (18)
    • 1. Libraly (19)
    • 2. Data type and variable (20)
  • VI. Use-case diagrams (22)
  • VII. Flow chart (24)
    • 1. Menu option (24)
    • 2. Input ID, name and score (27)
    • 3. Output student ID, name, score (29)
    • 4. Output find the students with the highest scores (30)
    • 5. Output find the student with the lowest score (32)
  • I. coding standards (35)
    • 1. Declare libraries, variables and arrays (35)
    • 2. Select menu function (35)
    • 3. Code enter the information of all students (36)
    • 4. Code print all student information (37)
    • 5. Code find the student with the highest score (38)
    • 6. Code find the student with the lowest score (39)
    • 7. End program (40)
    • 8. Default (40)
  • II. Results of the program (41)
    • 1. Enter student information (42)
    • 2. Print all student information (42)
    • 3. Print out the students with the highest scores (43)
    • 4. Print out the students with the lowest scores (43)
    • 5. End program (44)
  • I. Testing (44)
  • II. Evaluation (48)
    • 1. Advantages of the program (48)
    • 2. Disadvantages and difficulties of the program (48)
    • 3. Future progress improvements (48)
  • III. Conclusion (49)

Nội dung

Dựa trên các chỉ định và yêu cầu trong assignment, nếu bạn tuân thủ chúng một cách nghiêm ngặt và thực hiện công việc một cách cẩn thận, thì khả năng thành công của bạn là tuyệt đối, đạt tỷ lệ 100%. Bằng cách đáp ứng đầy đủ mọi yêu cầu và làm việc chăm chỉ, bạn sẽ đạt được kết quả mà bạn mong muốn.

General properties and limitations of the algorithm

Algorithm definition

An algorithm is a defined sequence of steps aimed at solving a problem or executing a task By analyzing and classifying the elements involved, algorithms facilitate informed decisions to reach the desired results Widely utilized in computer science, mathematics, and engineering, they address complex challenges and perform various functions, including searching, sorting, calculating, and data encoding and decoding.

The algorithm is essential for optimizing various sectors, including production processes, financial management, and scientific research It can be implemented across diverse software and hardware platforms, such as desktop, mobile, cloud, and embedded systems In the realm of information technology, algorithms are crucial for developing technology products and services on the internet.

Some algorithms

Computers use many different algorithms to perform different tasks Here are some common algorithms in computers:

Sorting algorithms are essential for organizing elements within a list in a specific order Some of the most widely used sorting algorithms include Bubble Sort, Quick Sort, Merge Sort, Insertion Sort, Selection Sort, and Heap Sort.

• Search Algorithm: An algorithm used to find an element in a selected list Popular search algorithms include Linear Search, Binary Search, Jump Search, Interpolation Search, Exponential

• Graph Algorithm: An algorithm used to solve problems related to graphs, including finding shortest paths, finding minimum tree frames, finding Euler paths, finding Hamilton paths

Image processing algorithms are essential for enhancing image quality and isolating different components within an image Notable techniques in this field include gradient-based algorithms, morphological methods, Fourier transform-based approaches, and watershed algorithms.

• Machine Learning Algorithm: An algorithm used to help computers automatically learn from data to make predictions or to classify new data Popular Machine Learning algorithms include Linear

Regression, Logistic Regression, Decision Trees, Random Forests, Support Vector Machines, Neural Networks

These are just some examples of computer algorithms There are many other algorithms that are used to solve different problems.

Examples of algorithms

Here is a simple algorithm to find the second largest value in an array Here are some examples of other algorithms:

STEP 1: Set low = 0, high = length of array - 1

STEP 2: while low target, then set high = mid - 1

STEP 7: return -1 (target not found)

STEP 1: Set n = length of array

STEP 2: for i = 0 to n-1, repeat STEP 3 to 6

STEP 3: for j = 0 to n-i-1, repeat STEP 4 to 5

STEP 4: if array[j] > array[j+1], then swap(array[j], array[j+1])

STEP 1: Set n = length of array

STEP 2: if n = pivot, then append array[i] to right

STEP 8: Set sorted_left = QuickSort(left), sorted_right = QuickSort(right)

STEP 9: return sorted_left + [pivot] + sorted_right

These are just some examples of computer algorithms Other algorithms can also be used to solve different problems.

Feature algorithm

An algorithm is a step-by-step procedure or set of instructions designed to solve a specific problem or perform a specific task Some of the key characteristics of algorithms include:

• Precision: Algorithms are precise and unambiguous, with each step clearly defined and well- structured

• Finiteness: Algorithms have a well-defined starting point and a well-defined endpoint The algorithm must eventually terminate, and it cannot run indefinitely

• Effectiveness: Algorithms are effective in solving a particular problem, providing a solution or output in a finite amount of time

• Input: Algorithms take input from the user or from other sources to begin the computation

• Output: Algorithms produce a solution or output based on the input and the algorithm's processing steps

• Repetition: Algorithms may require repeating a particular step or sequence of steps multiple times until the desired output is obtained

• Efficiency: Algorithms strive to be efficient in their use of time and resources, often using mathematical optimization techniques to achieve the desired outcome with minimal effort or computation

• Logic: Algorithms are based on logical reasoning and follow a logical sequence of steps to arrive at the solution or output

• Generality: Algorithms can be applied to a variety of inputs and can be used to solve a wide range of problems in different domains

Overall, the characteristics of algorithms make them powerful tools for solving complex problems and automating tasks in many different fields, including computer science, engineering, mathematics, and more.

Software Development Life Cycle (SDLC)

Definition

The Software Development Life Cycle (SDLC) is a structured process that encompasses all phases of software development, including requirements gathering, design, development, testing, deployment, and maintenance Each phase serves a specific purpose, contributing to the overall quality and reliability of the final software product.

• Requirements gathering: The first step of SDLC is to collect requirements from customers or users

This requirement may include functionality, features, user interface, specification, and other legal requirements

• Requirements Analysis: After collecting requirements, software developers analyze and evaluate these requirements to ensure their feasibility and accuracy

• Design: After requirements analysis, software developers design the architecture of the software

This includes providing architectural models, interaction diagrams, and system analysis

Once the design phase is finalized, the software developer initiates the programming and development of the software This crucial process encompasses writing code, packaging it, conducting unit tests, and integrating the code to ensure functionality.

• Testing: After developing the software, the software developer performs software testing to ensure the correctness, efficiency and meet the user's requirements

• Deployment: After the software has been tested and accepted, it is deployed and put to use

Software implementation may include installing the software, training users, and taking steps necessary to ensure the safety and security of the software

• Maintenance: Once the software has been deployed, software developers continue to monitor and maintain the software to ensure its stable and effective functionality.

Represents a small and simple problem

Managing student information is essential for teachers, and creating an algorithm can streamline this process by organizing and printing student data The program should feature a user-friendly main menu that allows teachers to easily input student registration numbers, names, and scores.

The algorithm is designed to pinpoint students with the highest and lowest scores, serving as an essential tool for monitoring progress and highlighting areas needing improvement This capability enables teachers to swiftly evaluate student performance and offer targeted support to those who require it most.

Utilizing an algorithm for student information management allows teachers to efficiently save time and effort while ensuring that all critical data is accurately recorded and readily accessible This quick access to student information enables educators to monitor progress over time, facilitating informed decision-making and enhancing the support provided to students.

Problem solving

Libraly

In the C# programming language, the "using System" directive means that you want to use the classes, methods, and properties defined in the "System" namespace

"System" is one of the standard predefined namespaces in C#, consisting of the basic classes, methods, and properties for object-oriented setup and information processing on the machine's system count.

Data type and variable

• Below is the data declared for the variable in the program, which will be used to solve the specific problem

Data Type Variable Description int MAX_STUDENT

The maximum number of students that can be stored. int choice The user's menu choice. int[] id

An array that stores the student ID for each student. string[] name

An array that stores the student name for each student. float[] score

An array that stores the score for each student. int n

The number of students currently stored in the arrays. int m

The highest possible score a student can receive. int k

The lowest possible score a student can receive. int i

Loop variable used to iterate through the arrays. float maxscore The highest score among all students. int peoplemax

The ID of the student with the highest score. float minscore The lowest score among all students. int peoplemin

The ID of the student with the lowest score.

• Below is the data declared for the array in the program, which will be used to solve the specific problem

Data Type Array Description int id An array to store the student ID numbers. string name

An array to store the names of the students. float score

An array to store the scores of the students. int n

An integer variable to store the number of students. int m

An integer variable to store the highest possible score for a student. int k

An integer variable to store the lowest possible score for a student. int choice

An integer variable to store the user's menu choice.

Flow chart

Menu option

• These are the steps of the menu in the given program:

1.1 Ask the user to enter the number of students

1.2 Ask the user to enter the maximum number of points a student can achieve

1.3 Ask the user to enter the lowest score a student can achieve

1.4 Ask the user to enter each student's information (ID, name, and grade) and store it in an array (When done, return to the main menu)

Step 2: Display information of all students

2.1 Displays the information of all students entered from step 1

Step 3: Find the student with the highest score

3.1 Find the student with the highest score from the list of imported students

3.2 Displays information about the student with the highest score

(When done, return to the main menu)

Step 4: Find the student with the lowest score

4.1 Find the student with the lowest score from the list of imported students

4.2 Displays information about the student with the lowest score

(When done, return to the main menu)

Step 5: Go back to the main menu

5.1 Return to the main menu

Input ID, name and score

▪ Steps to enter student ID, name and grade:

Step 2: Declare constant MAX_STUDENT with value 100 along with arrays of name, score and id, variable n to store the number of students, variable i to iterate over each student

(Declare const int MAX_STUDENT0; float score[MAX_STUDENT]; int id[MAX_STUDENT]; string[] name = new string[MAX_STUDENT] integer; int i=1)

Step 3: Enter the values of m and k

Step 4: Check if the value of i satisfies the condition i m and score < k), go to step 6

• If the score is wrong, the command line "You have entered an invalid score, please try again" will appear

Step 6: Increase the value of i by one unit

• Then go back to step 4 to check the condition

Output student ID, name, score

▪ Steps to print student ID, name and grade:

Step 2: Declare constant MAX_STUDENT with value 100 along with arrays of name, score and id, variable n to store the number of students, variable i to iterate over each student

(Declare const int MAX_STUDENT0; float score[MAX_STUDENT]; int id[MAX_STUDENT]; string[] name = new string[MAX_STUDENT] integer; int i=1)

Step 3: Check if the value of i satisfies the condition i

Ngày đăng: 17/06/2023, 16:30

w