You are on page 1of 19

Table of Contents

Introduction:................................................................................................................................................3
Part 1:......................................................................................................................................................3
Section 1:.............................................................................................................................................3
Section 2:.............................................................................................................................................6
Section 3..............................................................................................................................................8
Part 2.....................................................................................................................................................10
Section 1:...........................................................................................................................................10
Section 2:...........................................................................................................................................15
Section 3:...........................................................................................................................................19
References:............................................................................................................................................19
Introduction:
Part 1:
Section 1:
Concept:
The C# code implements a console-based program using a while loop for iterative execution. It utilizes
user input for decimal values, employs conditional statements to check the range, and includes a switch
statement for additional range evaluation. Reference: Microsoft Docs on C#.

Pseudocode:
 Initialize Loop:

 Set continueRunning to true.

 Start a while loop for iterative execution.

 User Input:

 Prompt the user to input a decimal value.

 Read the input as a string and convert it to a double (userValue).

 Check Range:

 Using an if condition, check if userValue is within the range of 5.5 to 10.5.

 If yes, display a message indicating that the value is within the range.

 If no, display a message indicating that the value is not within the range.

 Utilize a switch statement to check the range again, with a default case for the out-of-
range scenario.

 Continue Program:

 Ask the user if they want to run the program again (Y or N).

 If the response is affirmative, continue the loop; otherwise, exit the loop.
Flowchart:

Description:
The provided C# code implements a console program that repeatedly prompts the user to input a
decimal value. It checks if the input is within the range of 5.5 to 10.5 using both an if condition and a
switch statement. The program asks the user if they want to run it again, continuing the loop if the
response is affirmative. If the input is invalid, an appropriate message is displayed.
Code:

Screenshots:

Source:
Section 2:
Concept:
The C# code utilizes a while loop to repeatedly prompt the user for an integer between 1 and 100. It
employs a switch statement to determine a corresponding "pin" based on the entered number and
provides an option to continue the program. Reference: Microsoft Docs on C#.

Pseudocode
 Initialize Loop:

 Set continueRunning to true.

 Start a while loop for iterative execution.

 User Input:

 Prompt the user to input a number between 1 and 100.

 Read the input as a string and convert it to an integer (userNumber).

 Switch Statement:

 Using a switch statement, determine the "pin" number based on the user's input.

 Display the corresponding "pin" or an out-of-range message.

 Continue Program:

 Ask the user if they want to run the program again (Y or N).

 If the response is affirmative, continue the loop; otherwise, exit the loop.

Flowchart:

Description:
The provided C# code implements a console program that repeatedly prompts the user to input an
integer between 1 and 100. It uses a switch statement to determine a corresponding "pin" based on the
entered number. The program asks the user if they want to run it again, continuing the loop if the
response is affirmative. If the input is invalid, an appropriate message is displayed.
Code:
Screenshots:

Source:

Section 3
Concept:
The C# code implements a console program that utilizes a while loop to repeatedly prompt the user for a
mark between 0 and 100. It employs a switch statement to determine the corresponding grade and
displays a message based on the entered mark. The program offers an option to continue.

Pseudocode:
 Initialize Loop:

 Set continueRunning to true.

 Start a while loop for iterative execution.

 User Input:

 Prompt the user to input a mark between 0 and 100.

 Read the input as a string and convert it to an integer (userMark).

 Switch Statement:

 Using a switch statement, determine the grade based on userMark.

 Display an appropriate message for each grade.

 Continue Program:

 Ask the user if they want to run the program again (Y or N).

 If the response is affirmative, continue the loop; otherwise, exit the loop.
Flowchart:

Description:
The provided C# code implements a console program that repeatedly prompts the user to input a mark
between 0 and 100. It uses a switch statement to determine the corresponding grade based on the
entered mark. The program asks the user if they want to run it again, continuing the loop if the response
is affirmative. If the input is invalid, an appropriate message is displayed.

Code:
Screenshots:

Source:

Part 2
Section 1:
Concept:

Pseudocode:

Concept:
The C# code consists of three forms for an Access Control System: Register, Login, and Dashboard. The
Register form allows users to register with a username and password. The Login form checks user
credentials against hardcoded values and opens the Dashboard form upon successful login.

Pseudocode:

Register Form:

 Get values from textboxes (username, password1, password2).

 Check if any field is empty.

 Check if passwords match.

 If successful, show registration successful message, open Dashboard, and close Register window.

Login Form:

 Hardcode user credentials.

 Get entered username and password.

 Check if entered credentials match hardcoded values.

 If successful, hide Login window, open Dashboard, and optionally close the application.

 If unsuccessful, display an error message.

Dashboard Form:

 Display a welcome message with the username.

 Provide buttons to close the Dashboard or go back to the Login form.


Flowchart:

Description:
The C# code comprises three forms for an Access Control System. The Register form allows users to
register, the Login form checks credentials against hardcoded values, and the Dashboard form displays a
welcome message and provides options to navigate or close the application. Flowcharts and pseudocode
illustrate the logic and interactions in each form.
Code:
Screenshots:
Source:

Section 2:
Concept:
The C# code represents a simple student record system using Windows Forms. It utilizes a ListView to
display student information, and users can add, update, and delete student records. The program also
calculates and displays grades based on student marks.

Pseudocode:
 Initialize Form:
 Initialize the form with necessary components (e.g., ListView, TextBoxes, Buttons).

 In the Form_Load event, populate the ListView with sample student data.

 Add Student Record:

 Check if any required field is empty.

 If fields are filled, insert data into the ListView.

 Clear TextBoxes after insertion.

 Update Student Record:

 Check if a student is selected in the ListView.

 If selected, update the selected item with TextBox values.

 Clear TextBoxes after updating.

 Delete Student Record:

 Check if a student is selected in the ListView.

 If selected, remove the item from the ListView.

 Clear TextBoxes after deletion.

 Calculate Grade:

 If a student is selected, get marks from the ListView.

 Parse marks to an integer.

 Calculate and display the grade in label.

Flowchart:
Description:
The C# code implements a Windows Forms application for managing student records. Users can add,
update, and delete student records, and the program calculates and displays grades based on student
marks. The form is initialized with components, and sample data is loaded on form load. User
interactions trigger actions such as adding, updating, and deleting records, as well as calculating grades.
Error messages are displayed for invalid operations.

Code:
Screenshots:

Source:
Section 3:
Personal Reflection:
Pseudocode and Flowchart Design: Creating accurate pseudocode and flowcharts presented a challenge
in condensing complex logic into concise, comprehensible representations. It required careful
consideration of syntax and the identification of essential steps. Overcoming this difficulty enhanced my
ability to translate high-level program logic into visual representations.

GUI-Based Application Development: The assignment significantly contributed to my progress in GUI-


based application development. It reinforced core programming concepts and extended my proficiency
in creating Windows Forms applications. Practical exposure to multi-form applications, user input
validation, and seamless component integration provided valuable hands-on experience.

Logical Program Structuring: The task emphasized the importance of logical program structuring and
documentation in C#. It highlighted the need for clear organization and flow, fostering a deeper
understanding of how to structure code effectively. This aspect aligns with broader learning outcomes,
reinforcing my commitment to producing well-documented and maintainable code in future projects.

References:
1. Title: "C# Programming Yellow Book" Author: Rob Miles Publication Year: 2014 Publisher:
Unknown (available online) URL: C# Programming Yellow Book

2. Title: "Microsoft Docs - C# Programming Guide" Author: Microsoft Publication Year: Ongoing
Publisher: Microsoft URL: C# Programming Guide

3. Title: "GPT-3: Language Models for Few-Shot Learning" Authors: OpenAI Publication Year: 2020
Publisher: OpenAI URL: arXiv:2005.14165

4. Title: "PlantUML - Unified Modeling Language" Author: PlantUML Publication Year: Ongoing
Publisher: PlantUML URL: PlantUML Official Website

5. Title: "Head First C#" Authors: Andrew Stellman, Jennifer Greene Publication Year: 2013
Publisher: O'Reilly Media ISBN-13: 978-1449343507

6. Title: "Windows Forms 2.0 Programming" Author: Chris Sells Publication Year: 2006 Publisher:
Addison-Wesley ISBN-13: 978-0321267962

You might also like