Programming C# (1618) ASM1, Study Guides, Projects, Research of Programming Languages

Assignment 1 Programming C# . Grade P, M

Typology: Study Guides, Projects, Research

2022/2023

Uploaded on 08/07/2022

Phan-Nhat-Linh-11
Phan-Nhat-Linh-11 šŸ‡»šŸ‡³

4.9

(108)

34 documents

1 / 31

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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
Phan Nhat Linh
Student ID
GCD201635
Class
GCD0905
Assessor name
Nguyen Van Loi
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
Linh
Grading grid
P1
M1
D1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f

Partial preview of the text

Download Programming C# (1618) ASM1 and more Study Guides, Projects, Research Programming Languages 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 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Phan Nhat Linh Student ID GCD Class GCD0905 Assessor name Nguyen Van Loi 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 Linh Grading grid P1 M1 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

Table of Contents

CHAPTER I: ALGORITHM 1 Definition An algorithm is a step-by-step technique for solving a collection of issues in general. It is a well-defined approach in computing that allows a machine to solve a mathematical problem or solve another problem. Computation, data processing, and automated reasoning are all activities that algorithms are capable of completing. Figure 1 : Example of the algorithm (Flowchart)

2 Types of algorithm Figure 2 :Three types of algorithm

2.1 Selection Construct

A programming concept in which a chunk of code is only executed if a condition is satisfied is known as selection. There are times in programming when a decision must be taken. Making a decision is the process of selection. The outcome of the decision influences the program's future steps.

2.2 Sequence Construct

A set of logical steps is carried out in order. Computers need instructions in the form of an algorithm to complete the desired task, and this algorithm must have the correct order of steps or sequence.

2.3 Looping Construct

When the same set of steps must be performed several times, looping structures are utilized. A counter or a test that is run every time the loop is run to see if it should be run again is frequently present.

3.2 Output specified

Figure 4 : Input - Output relation The information obtained as a result of the computation is the output. At least one all-around described output is required for an algorithm, and the ideal output should be coordinated. Exactness in output also demands knowing what kind of information, how much, and in what format the output should be.

3.3 Clear and Unambiguous

Algorithms must decide each step, and each step must be distinct in all behaviors and lead to a single meaning. As a result, the algorithm should be simple and straightforward. Each step's specifics must also be discussed (counting how to deal with errors). Everything in it should be measurable, not subjective.

3.4 Feasible

The algorithm must be effective, which means that all of the steps required to get the desired result must be achievable with the available resources. It should not include any unnecessary or excessive developments that might render an algorithm ineffective.

3.5 Independent

Step-by-step instructions should be included in an algorithm, and they should be independent of any programming code. It should be done with the expectation that there may be a sudden increase in demand for any of the programming languages.

3.6 Finiteness

At some point, the algorithm will have to stop working. If you stop, you could obtain the typical output. Algorithms must terminate when a certain number of steps have been completed. An algorithm should not be limitless and should always come to a halt after a set number of steps. There is no use in developing an infinite algorithm since it will be useless to humans.

*Example: Find the area of a rectangle Figure 5 : Calculate the area of a rectangle by C# Figure 6 : Result of the program in figure 5 4 Why are algorithms important to understand? In a variety of fields, the ability to think in terms of algorithms, or the ability to develop clear techniques to solve a problem, is crucial. When employing algorithmic thinking to break down difficulties and envisage solutions, it is possible to consider in terms of distinct steps. Individuals must build ordered thinking and reasoning abilities via repetition in order to grasp and execute an algorithm. Understanding algorithms may help programmers solve problems more quickly, efficiently, and correctly.

Figure 8 : Deploy that algorithm on the Visual Studio 2022 Figure 9 : Result of figure 8 CHAPTER II: THE SOFTWARE DEVELOPMENT LIFE CYCLE

1. Definition The Software Development Life Cycle, or SDLC, is a method for producing high-quality, low-cost software in the least amount of time. SDLC is a well-structured flow of stages that enables a company to swiftly develop high-quality software that has been thoroughly tested and is ready for production. As stated in the introduction, the SDLC is divided into six phases. The waterfall model, spiral model, and Agile model are all popular SDLC models.

Figure 10 : The Software Development Life Cycle So, what is the Software Development Life Cycle and how does it work?

2. How the SDLC Works SDLC reduces the cost of software development while both enhancing quality and speeding up the production process. SDLC accomplishes these seemingly disparate objectives by adopting a strategy that avoids the common hazards of software development projects. This strategy begins with a review of current systems for flaws. It then describes the new system's needs. It then goes through the processes of analysis, planning, design, programming, testing, and deployment to build the software. SLDC may avoid needless rework and after-the-fact corrections by predicting costly mistakes like forgetting to ask the end-user or customer for input. It's also vital to note that the testing phase receives a lot of attention. You must assure code quality at each cycle since the SDLC is a recurring approach. Many companies put little effort into testing, despite the fact that a higher focus on testing might save them a lot of rework, time, and money. 3. Stages and Best Practices - Planning: The planning phase focuses on identifying the problem, gathering information needed to plan a solution, and a review of all the available data. This is the most important part of the project since effective planning can eliminate the majority of problems.

1.2 Design Solutions

We are going to create a game called rock-paper-scissors Game. Each person will compete against the machine. If the player wins, the player will receive the entire bet and vice versa, if the player loses, the player will lose that amount. The game has the option of withdrawing and depositing money.

2. Implementation

2.1 Introduction function

a. Source code Figure 11 : Introduction function The program will first ask the player to enter his or her name. The player will then be asked to enter the age number. If the player is less than 18 years old, the program will issue a warning. If the player enters an age less than 0 they will be asked to re-enter. Finally, input your budget.

b. Flowchart Figure 12 : The flowchart of Introduction function This function will ask you to enter your name and age, the program will check, if age <= 0 then the while loop will ask you to re-enter, if false, the program will check age < 18. If true, the program The program will give you a message and ask you to enter your budget, if it is wrong, the program will ask you to enter your budget. c. Result Figure 13 : The result of Introduction function These lines only appear once when you enter this game.

2.3 Implementation function

a. Source code The game will ask you to enter the amount you want to bet. If the stake is zero or more than your budget, the program will force you to re-enter it. To continue you will have to enter your selection. If you enter a number greater than 3 or less than 1, the program will force you to enter it again. Then we use if statements to do what we want. Figure 16 : Implementation function

b. Flowchart Figure 17 : The flowchart of Implementation function First, at the start of the function, the player will be asked to enter the bet amount. The program will check Bet > Money and Bet < 0. If correct, the program will ask you to re-enter, if wrong, you will be able to enter your choice. The program will check for 1<=yourchoice <=3, if it is false you will have to re-enter it, if it is true then the program will give you the result and terminate the function. c. Result Figure 18 : The result of Implementation function