Assignment1 of the C Sharp language, Assignments of Programming Languages

• Need to raise business issues that need to be resolved. • Analyze the problem carefully and design a solution using the same approach as designing a management program. • Show how to compile and run the borrowed program • Judging from problem solving, design to execution, is written by a C# programmer. • Can come up with solutions in the future to improve our programs better

Typology: Assignments

2020/2021

Uploaded on 09/18/2021

le-linh-dan
le-linh-dan 🇻🇳

4.5

(22)

9 documents

1 / 34

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Le Thi Phuong Anh_ GCH200052 1
ASSIGNMENT 1 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Unit 1: Programming
Submission date
22/8/2021
Date Received 1st submission
Re-submission Date
Date Received 2nd submission
Student Name
Lê Thị Phương Anh
Student ID
Class
GCH0907
Assessor name
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
Anh
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
pf20
pf21
pf22

Partial preview of the text

Download Assignment1 of the C Sharp language and more Assignments 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 22 /8/2021 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Lê Thị Phương Anh Student ID Class GCH0907 Assessor name 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 Anh Grading grid P1 M1 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

  • I. Introduction - I.1. Problem statement - I.1.1 Scenario - I.1.2 Problem
  • II Software Development Life Cycle I.1.3 Solution Error! Bookmark not defined. - II.1 Waterfall model - II.2 Spiral model
  • III. Explain.....................................................................................................................................................................
    • III.1 Variables, Data types and struct type
      • III.1.1 Variable
      • III.1.2 Data types
      • III.1.3 Structure types
    • III.2 Conditional statements
    • III.3 Loop statement
    • III.4 Function
    • III.5 Flowchart
      • III.5.1 Use – case
      • III.5.2 Flowchart
  • IV Implementation
    • IV.1 Code
      • IV.1.1 Input information of the customer
      • IV.2.2 Display list information of the customer in screen
      • IV.2.3 Room classification by price
    • IV. 3 Result.............................................................................................................................................................. IV.3.5 Sort by room code Error! Bookmark not defined.
      • IV.1.1 Input the information
      • IV.1.2 Display the information
      • IV.1.3 Classify room
      • IV.1.4 Search information of customer by IC card
      • IV.1.5 Sort of room rate
  • V. Testing
    • VI Evaluation
  • VII Conclusion
  • Reference List:

I. Introduction When participating in the interview, apply for an internship position for a software development company. For admission, it is necessary to demonstrate basic programming and problem-solving skills. To do this, I need to write a report on the use of algorithms to solve problems that must be prepared by giving examples, how algorithms are used to solve problems, and steps to be taken to create them, giving a working program solution. It is necessary to create a program. And problem solving involves basic procedural programming instructions - sequence instructions (input, output, and assignment statements), loops, conditional statements. To complete the best program, to be Grey through the language setting C Sharp " C# (pronounced as 'C Sharp') is a new computer-programming language by Microsoft Corporation, USA. C# is a fully object - oriented language like Java and is the first component- oriented language. It has been designed to support the key feature of .NET Framework, the new development platform of Microsoft for building component - based software solutions. " (Balagurusamy 2007, p.1). Figure 1: C Sharp Programming Language

Development Process. ISO/IEC 12207 is a universal standard for program life-cycle forms. It points to be the standard that characterizes all the errands required for creating and keeping up program. Figure 2 : Software Development Life Cycle Tutorialspoint (2021) research indicates that SDLC could be a prepare taken after for a program extend, inside a computer program organization. It comprises of a point by point arrange depicting how to create, keep up, supplant and modify or improve particular program We all know “SDLC is a methodology for designing, building, and maintaining information and industrial systems. So far, there exist many SDLC models, such as the Waterfall model, Spiral model, Big Bang model or Agile model” (Alshamrani & Bahattab, 2015). Here is an introduction to the most important and popular model followed in the industry II.1 Waterfall model Alshamrani & Bahattab (2015) considered that The Waterfall Model is the oldest and the foremost well know. SDLC model. The goes downward highlight of this model is its sequential steps. It goes descending through the stages of necessities examination, plan, coding, testing, and support. In addition, it guarantees the plan imperfections before the development of a product. Stages that build this show are not covering stages, which suggests that each phase must be completed before the next phase can begin and there is no overlapping in the phases.

Image 3 : Waterfall model is broken down into multiple phases The following steps give a brief description about the waterfall process: ➢ Stage 1: Requirement Analysis ➢ Stage 2: Design ➢ Stage 3: Development ➢ Stage 4: Testing ➢ Stage 5: Deployment ➢ Stage 6: Maintenance Next, we find out the advantages and disadvantages of this model: ❖ Advantages of the Waterfall model

  • Specific deliverable and review process: Each stage contains a particular deliverable and audit handle. After the necessity stage, we have all the prerequisites of what the client needs. Once the computer program is created, we have its deliverable.
  • Phases do not overlap: In this model, stages don't cover, i.e., they are completed once at a time. Once the past stage is completed, at that point as it were another stage gets begun. For case, the Advancement stage will begin as it were when the plan stage is completed.

The four steps give a brief description about the Spiral model phases: ➢ Stage 1 Planning ➢ Stage 2 Risk Analysis ➢ Stage 3 Development/Engineering ➢ Stage 4 Evaluation Phase This Spiral model also has its advantages and disadvantages Advantages of the Spiral model:

  • Highly accurate risk analysis
  • Software is produced early in the software life cycle.
  • Approved and strictly controlled
  • People interested in the same product review each stage early because of the rapid prototyping tools
  • Users easily respond Disadvantages of the Spiral model:
  • High cost
  • High expertise is required for risk assessment
  • Amount documentation required in
  • intermediate stages make management of a very complex project. III. Explain To create a manager program. First, we need to understand C# programming language. Know how to use variables and data types like int, float, double, string, ... and how to declare functions. Besides, there are loops like for, while, do - while, conditions of statements like if, else if, along with statements III.1 Variables, Data types and struct type III.1.1 Variable Like most programming dialects, C# allows the declaration of variables. We can simply understand that if a variable in mathematics is a mutable number, then in programming a variable is a data value that can be changed. They are names that refer to a certain area in memory. It is also the core component of a

programming language. In my program, the variables to declare the object's information are name, ID card, date of birth, gender, room code and room rate. Thus, declaring variables to store data and reuse. Figure 5 : Example of variable III. 1. 2 Data types Along with the variable is the data type. In simple terms, a data type is a collection of groups of data with the same characteristics, storage and handling operations on that data field. It is a signal to the compiler to know the size of a variable (int is 4 bytes) and its capacity (int can only hold integers). At the same time, just like variables, they are an integral part of a program. So, there must be a data type to recognize the size and capacity of a variable and for the purpose of data classification. If there is no data type, it is very difficult to process because we do not know whether this variable is a string or an integer or a real number. Figure 6 : Example of data types A data type indicates size and type of variable values. It is critical to utilize the proper information sort for the corresponding variable; to dodge blunders, to save time and memory, also help your code more viable and discernable. The foremost common information sorts are:

III. 1. 3 Structure types In C#, struct is the value type data type that speaks to data structures. It can contain a parameterized constructor, static constructor, constants, properties, ...Struct is a structured data type that makes it convenient for programmers to manage data and program. This is a parameter data type used to encapsulate different but related data fields. Figure 8 : Struct type And with this declaration we have a new data type named CustomerManagement. And can declare variable, use it like using other data types. If the type int can contain integers, type double can contain real numbers, the type Customer has just declared can contain 5 subfields of information: name, age, card ID, gender, check-in time and room code. III. 2 Conditional statements Conditional statements in C# programming are used to make choices based on conditions. If you place several conditions on a block of statements, the flow of execution may change based on the result evaluated by the condition. This preparation is called decision making in 'C#'. In 'C#' programming there are two common constructs:

  • If statement
  • If - else if statement

Figure 9: Example about if statement The if-else statement is an extension of If. For if-else, execute the command line inside the if statement if the condition is true, and vice versa, execute the line of code in the else explanation, in case the if condition is false Figure 10: Example about if else statement The if - else if - else statement allows the execution of a block of code between different choices. The conditions will execute from the top is starting from the if loop, then the else if and finally the else. Using this statement will make our code that requires typing simpler and easier to use as well

Figure 13 : Example about while loop The for loop repeats a block of statements until the specified condition returns false. And in case, when we know the exact number of times you want to loop through a block of code, the employee determines how many guests he wants to enter, say 20 students, we use the for loop as an alternative to the while loop because it defines the number of loops. It also makes the code simpler Figure 14: Example about for loop

III.4 Function Because executing a piece of code many times, instead of having to copy and copy that code many times leading to the program being duplicated many times, in c# there is a function that allows us to execute certain code many times without having to copy the code, but just call the function name. In simple terms, a function is a block of code used to execute the statements specified in that block of code. A function consists of the following components:

  • Function Name: A unique name used to call the function. Example: Output (), Input (int a, int b)
  • Return Type: It is used to specify the data type of the returned function.
  • Function Body: It is the block of code that will be executed when the function is called. III. 5 Flowchart In addition to understanding variables, data types, conditional statements, loops, ... To complete a management program, we cannot lack the step of building use cases and flowcharts. “Flowcharts and use case diagrams often have the same level of representation, but differ in linearity. Flowcharts are a higher level of abstraction, used before writing a use case or for documentation” (Bittner &Spence 2004, p.11). And using them makes the programming process simpler and more practical. To better understand the program and the functions performed, let's follow the use-cases and flowcharts. It will greatly help our programming proces.

III. 5 .2 Flowchart

Figure 16: Main menu This is the main flowchart of the program so that it can help people somewhat visualize our program