Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Assignment 2 - 1618 C# Programming, Assignments of Computer Science

This assignment got Pass grade. Hopefully, it will help u!

Typology: Assignments

2021/2022

Uploaded on 09/16/2023

ecco3kdaddy
ecco3kdaddy 🇻🇳

6 documents

Partial preview of the text

Download Assignment 2 - 1618 C# Programming and more Assignments Computer Science in PDF only on Docsity! ASSIGNMENT 2 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 Student ID Class 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 Grading grid P2 P3 P4 P5 M2 M3 M4 D2 D3 D4  Summative Feedback:  Resubmission Feedback: Grade: Assessor Signature: Date: Lecturer Signature: Chapter 1 – Introduction your program 1. Introduce the Overview ➢ In this assignment, I would like to write a program about the general system of the book management system. The system includes types, such as adding books, displaying the data on the screen, sorting, and searching for books users want to find. The Internet nowadays is very developed, and so is the book management system. Instead of entering the information on paper, the users can enter it on the computer. This method is the best choice because it’s fast and effective. 2. List out application’s requirements ➢ Well, to the system management operations, it needs some following requirements: • There are functions: Add, display, sort, and search. • The program needs to run on Console App (C#) in Microsoft Visual Studio 2022. • The system must have a Main Menu that users can operate types. • Check if the users inputted the data is missing or not. Chapter 2 – Explain programming paradigms 1. Explain what is Procedural programming with source code and illustrations Definition: ➢ Procedural programming Could also be the primary programming paradigm that a replacement developer will learn. Fundamentally, the procedural code is that the one that directly instructs a tool on the way to finish a task in logical steps. This paradigm uses a linear top-down approach and treats data and procedures as two different entities. supported the concept of a procedure call, Procedural Programming divides the program into procedures, which also are referred to as routines or functions, simply containing a series of steps to be administered. Simply put, Procedural Programming involves writing down an inventory of instructions to inform the pc what it should do step-by-step to end the task at hand. The Key Features of Procedural Programming: ➢ The key features of procedural programming are given below: • Predefined functions: A predefined function is usually an instruction identified by a reputation. Usually, the predefined functions are built into higher-level programming languages, but they’re derived from the library or the registry, instead of the program. One example of a pre-defined function is ‘charAt()’,which searchers for a personality position during a string. • Local Variable: an area variable may be a variable that’s declared within the main structure of a way and is restricted to the local scope it’s given. The local variable can only be utilized in the tactic it’s defined in, and if it were to be used outside the defined method, the code will cease to the figure. • Global Variable: a worldwide variable may be a variable that's declared outside every other function defined within the code. thanks to this, global variables are often utilized in all functions, unlike an area variable. • Modularity: Modularity is when two dissimilar systems have two different tasks at hand but are grouped to conclude a bigger task first. Every group of systems then would have its tasks finished one after the opposite until all task are complete. • Parameter Passing: Parameter Passing may be a mechanism won’t to pass parameters to functions, subroutines, or procedures, s. Parameter Passing are often done through ‘pass by value’, ‘pass by reference’, ‘pass by result’, ‘pass by value results and ‘pass by the name’. Advantages and Disadvantages of Procedural Programming ➢ Procedural Programming comes with its own set of pros and cons, a number of which are mentioned below. Advantages: • Procedural Programming is superb for general-purpose programming. • The coded simplicity a long side simple implementation of compilers and interpreters • An outsized sort of books and online course material available on tested algorithms, making it easier to find out along the way. • The ASCII text file is portable, therefore, it is often wont to target a special CPU also. • The code is often reused in several parts of the program, without the necessity to repeat it. • Through Procedural Programming technique, the memory requirement also slashes. • The program flow is often tracked easily. Disadvantages: • The program code is harder to write down when Procedural Programming is used. • The Procedural code is usually not reusable, which can pose the necessity to recreate the code if is required to use in another application. • Difficult to relate with real-world objects. • The importance is given to the operation instead of the information, which could pose issues in some data-sensitive cases. • The info is exposed to the entire program, making it not such a lot security friendly. 2. Explain what is Object-Oriented Programming with source code and illustrations Definition: ➢ OOP is a programming style that understands life as a collection of objects that work together to solve a specific problem. The most important aspect of OOP is encapsulation, which is the concept that each object that holds the program is self-sustaining, meaning that all of the components that make up the object are contained inside it. Now that each module in this paradigm is self-sustaining, items from one program may be taken and utilized to address another problem with little or no changes. Advantages: • OOP is easy to maintain because of its modularity and encapsulation. • OOP simulates the real world, making it simpler to comprehend. • Because objects are complete in and of themselves, they may be reused in other applications. Disadvantages: • Object-Oriented applications are often sluggish and consume a lot of memory. • Over-generalization. • Programs designed using this paradigm may take longer to develop. The characteristics of OOP: - Class definition – Basic building blocks OOP and one entity which has data and operations on data together. - Objects – The instances of a category that are utilized in real functionality – its variables and operations. - Abstraction – Specifying what to try to but not the way to do; a versatile feature for having an overall view of an object’s functionality. - Encapsulation – Binding data and operations of knowledge together during a single unit – a category adheres to this feature. - Inherit and sophistication hierarchy – Reusability and extension of existing classes. ✓ Build automation tools: These can help automate developer tasks that are more common to save lots of time. In addition, some IDEs can also include. ✓ Class browser: won’t to study and reference properties of an object-oriented class hierarchy. ✓ Object browser: won’t to inspect objects instantiated during a running application. ✓ Class hierarchy diagram: This allows developers to see the structure of object-oriented programming code. The IDE could also be a stand-alone application, through it’d even be included as a part of one or more compatible applications. Microsoft Visual Studio: Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. it's wont to develop computer programs, also as websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms like Windows API, Windows Forms, Windows Presentation Foundation, Windows Store, and Microsoft Silverlight. It can produce both native code and managed code. Visual Studio supports 36 distinct programing language s and allows the code editor and debugger to support (to varying degrees) nearly any programming language, provided a language-specific service exists. Built-in languages include C,[9] C++, C++/CLI, Visual Basic .NET, C#, F#,[10] JavaScript, TypeScript, XML, XSLT, HTML, and CSS. Support for other languages like Python,[11] Ruby, Node.js, and M among others is out there via plug-ins. Java (and J#) were supported within the past. Figure 3: Visual Studio 2022 2. Introduce features of IDE with illustrations ➢ Basic features of popular IDEs: • Test editor: Almost every IDE will have a text editor designed for writing and manipulating source code. Some tools may have visual elements for dragging and dropping user interface elements, but most have simple interfaces with language-specific syntax highlighting such as Turbo Pascal, Notepad++, etc. • Debugger: Debugging tools help users identify and fix errors in the source code. They often simulate real-world scenarios to test functionality and performance. Programmers and software engineers can often test different segments of code and identify bugs before an application is released. • Compiler: Compilers are components that translate a programming language into a language that a computer can process, such as binary code. Machine code is analyzed to ensure its accuracy. The compiler then parses and optimizes the code to optimize performance. • Code completion: Code complete features assist programmers by intelligently identifying and inserting common code elements. These features help developers save coding time and reduce the chance of syntax errors. • Support programming language: IDEs are usually specific to one programming language, although some also offer multilingual support such as the Sublime Text IDE. As such, the first step is to find out what language you are using and choose an appropriate IDE. • Multiple Plugins Support: With an integrated development environment, it is not surprising that integration needs to be considered when choosing IDEs. Your IDE is your development portal, so being able to combine all your other development tools improves development workflow and productivity, 3. An explanation and evaluation of debugging process in the IDE used and how it helped with development ➢ “Debugging” explanation: Debugging is the process of detecting and removing of errors and potential errors (also called as “bugs”) during a software code that will cause it to behave unexpectedly or crash. To stop the incorrect operation of a software or system, debugging is employed to seek out and resolve bugs or defects. When various subsystems or modules are tightly coupled, debugging becomes harder as any change in one module may cause more bugs to appear in another. Sometimes it takes longer to debug a program than to code it. ➢ “Debugging” description: To debug a program, the user has got to start with a drag, isolate the ASCII text file of the matter, then fix it. A user of a program must skilled to repair the matter as knowledge about problem analysis is predicted. When the bug is fixed, then the software is prepared to use. Debugging tools (called debuggers) are wont to identify coding errors at various development stages. They are wont to reproduce the conditions during which error has occurred, then examine the program state at that point and locate the cause. Programmers can trace the program execution step- by-step by evaluating the worth of variables and stop the execution wherever required to urge the worth of variables or reset the program variables. Some programing language packages provide a debugger for checking the code for errors while it's being written at run time. “Debugging” processes: 1. Reproduce the matter. 2. Describe the bug. attempt to get the maximum amount of input from the user to urge the precise reason. 3. Capture the program snapshot when the bug appears. attempt to get all the variable values and states of the program at that point. 4. Analyze the snapshot supported by the state and action. supported that attempt to find the explanation for the bug. 5. Fix the prevailing bug, but also make sure any new bug doesn't occur. 4. Evidence that you have used debugging during the implementation ➢ Here I will describe how I use debugging in software development. ➢ First, I will use breakpoint selection by clicking on the column to the left of the code, there will be a red dot as shown. Then I press F5 to start the debug process. Figure 7: Run to cursor • Edit code while executing - In Visual Studio you can edit your code in the middle of a debugging session and continue debugging. To use this feature, click on your code with the cursor while pausing in the debugger, make edits and press F10 to resume debugging. Figure 8: Edit the code while the program is running • Examine the call stack - The Call Stack window shows the order in which methods and functions are being called. This is a good way to test and understand the execution flow of an application. Figure 9: Call Stack Window 5. An evaluation of developing applications using an IDE versus developing an application without using an IDE ➢ Using IDE: - IDE makes it easier and more convenient for you to develop applications, even though you don't need an IDE, you can still write source code, because actually to run the source code of a certain programming language, we just need the corresponding compiler (compiler) of that language. The IDE has a built-in compiler or interpreter inside it that helps you execute code directly when you are programming applications, typically Visual Studio 2022. After using the IDE for programming, I have been able to draw out the following features. the following network points: Figure 10: Using IDE (VS) to write code ➢ Don’t use IDE: - Imagine you use Microsoft Word to write a program, then you have to save the file as a file format according to the language you use. Then run that code again using that language's compiler application. Just imagining it makes me feel uncomfortable. Can you memorize all the syntax of the command to confidently program without using IDE? Moreover, it is also very difficult to avoid syntax errors in the process of writing code. And if your program is 1000 lines long, how long will it take you to find the error? Here is an example of using Word to write code. Figure 11: Using Microsoft Word to write code - Actually, this is the code I copied from Visual Studio and then pasted it here because if I wrote it myself, it would never comply with this coding standard. If you want to write accurately and clearly, it will take time and effort. Figure 12: Main menu system ➢ Search Book function: Figure 13: Search book function 2. Source code and screenshots of the final application with explanation • Source code: Main menu hub UNIVERSITY of GREENWICH acne tn GE aston O references static void Main(string[] args) if var Books = new List<Book>(); Library library = new Library(); int choice = 0; do { ShowMenu(); bool check = false; while(check == false) { try choice = int.Parse(Console.ReadLine()); if (choice > @) check = true; else Console.Write("Invalid input, please re-input choice again (1-6) here!:"); 5 catch (Exception) { Console.Write("Invalid input, please re-input choice again (1-6) here! } 3: switch (choice) { case 1: library .Addbook(Books); break; case 2: library. PrintBook(Books); break; case 3: library .SortbyYear(Books); break; case 4: library .FindbyName(Books); break; case 5: Library .FindbyName(Books) ; break; case 6: Console.WriteLine("See you again, thank you!" break; default: Console.Clear(); Console.WriteLine("Invalid input, please enter again! break; } } while (choice != 6); Figure 14:Main menu hub ➢ After finishing the system, the main menu hub will appear. ➢ The main menu hub in the program will have a do-while loop and switch-case. Its mission is to let users choose which options they want, with options from 1 to 6, in case users don’t insert the given numbers, the system will return to the main menu. ➢ The main menu will have the following types of options: 1. Enter the number of books users want to add. 2. Display the information all of the books that users have entered before. 3. Sort the information of books following the year of publication. 4. Search the book through the name of the book. 5. Search book through the name of the author. • Source code: Add book Figure 16: Display ➢ Now you can see, after entering the required information, the system will save your data and when you want to see your data, the system will appear the information throughout case 2 “Display”. • Source code: Sort year Figure 17: Sort book through year ➢ “Sort” option will operate and arrange book through from 1970 to 1997, from the old year to recent year. • Sourcode: Search book in name of the book 0 UNIVERSITY of e GREENWICH ¢ e proce vis IID non ‘B i EC eam public void FindbyName(List<Book> Books) { Console.Write("Enter the name of the book to find:"); String searching = Console.ReadLine(): bool result = false; for (int i = 0; i < Books.Count; i++) { if (Books[i].Name == searching) { Books[i] .PrintBook(): result = true; } } if C!result) { Console.WriteLine("This book isn't available"); 3 Input your choice:4 Enter the name of the book to find:Harry Potter Information about the book sola aaa name:Harry Potter author:J. K. Rowling publisher:Bloomsbury publishing year of publication:1997 language of the book:English 4. Explain the benefits of using coding standards ➢ Benefits of coding standards: a. Increase Efficiency: - It has been observed that software developers spend a big amount of your time in resolving issues that would are prevented. Establishing coding standards enables the team to detect problems early or prevent them entirely. This enhances the efficiency throughout the software process. b. Minimize the danger of Project Failure: - Many a time IT projects fail thanks to software development problems. Coding standards reduce the danger of failures. c. Reduces Complexity: - The higher the complexity of a code the more vulnerable it’s to errors. Coding standards help develop software programs with reduced complexity thereby minimizing errors d. Maintenance becomes easier: - If an ASCII text file is consistent it is often easily maintained. this is often because anyone can step in at any stage to maintain it or incorporate any modifications. e. Correction of bugs: - A consistent ASCII text file makes it easy to locate and proper bugs within the software. f. A comprehensive view: - A consistent ASCII text file facilitates a clearer view of how the code fits within the larger application or the corporate as an entire. g. Cost saving: - A consistent code leads to transparent view which successively results in the potential for more code reuse. This drastically reduces the value and development effort. References Anon, 2015. Characteristics of Object-Oriented programming language - oops. [Online] Available at: https://www.careerride.com/oops-characteristics.aspx [Accessed 19 8 2022]. Anon, 2018. Event-Driven Programming. [Online] Available at: https://www.techopedia.com/definition/7083/event-driven-program [Accessed 19 8 2022]. Anon, 2021. What is An Intergrated Development Environment (IDE)?. [Online] Available at: https://www.veracode.com/security/integrated-development-environment [Accessed 21 8 2022]. Anon, 2022. Definition of 'Debugging'. [Online] Available at: https://economictimes.indiatimes.com/definition/debugging [Accessed 21 8 2022]. Anon, 2022. Event-driven programming. [Online] Available at: https://en.wikipedia.org/wiki/Eventdriven_programming [Accessed 19 8 2022]. Anon, 2022. Microsoft Visual Studio. [Online] Available at: https://en.wikipedia.org/wiki/Microsoft_Visual_Studio [Accessed 21 8 2022]. Anon, 2022. object-oriented programming. [Online] Available at: https://www.pcmag.com/encyclopedia/term/object-oriented-programming [Accessed 19 8 2022]. Anon, 2022. Welcome to the Visual Studio IDE. [Online] Available at: https://docs.microsoft.com/en-us/visualstudio/get-started/visual-studio-ide?view=vs-2022 [Accessed 21 8 2022]. Bhatia, S., 2022. Procedural Programming. [Online] Available at: https://hackr.io/blog/procedural-programming [Accessed 19 8 2022]. Jaswinder, 2017. The Signifcance of Coding Standards. [Online] Available at: https://webguruz.in/blog/the-significance-of-coding-standards/ [Accessed 21 8 2022]. UNIVERSITY of GREENWICH ¢ ° sees gl x10 “BT EC
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved