Posts

Showing posts with the label C#

Console app: Building a Library Management System in C#

Image
Introduction In this blog post, I will guide you through creating a simple Library Management System in C# that utilizes the concepts of encapsulation, polymorphism, and inheritance. This exercise is perfect for practicing object-oriented programming principles. Objective Create a simple Library Management System that demonstrates encapsulation, polymorphism, and inheritance. Requirements 1. Encapsulation    Create a `Book` class with private properties: `Title`, `Author`, `ISBN`, and `IsAvailable`.    Provide public methods to get and set these properties as needed. 2. Inheritance    Create a base class `LibraryItem` with common properties such as `ID`, `Title`, and `IsAvailable`.    The `Book` class should inherit from `LibraryItem`.    Create another derived class `Magazine` that inherits from `LibraryItem` and has additional properties such as `IssueNumber` and `Publisher`. 3. Polymorphism Create a method `DisplayDetails` in the `Lib...

Beginner: Temperature Converter in C#

Image
Introduction In this tutorial, we will create a simple console application in C# that converts temperatures between Celsius, Fahrenheit, and Kelvin. This is a great project for beginners to practice basic programming concepts and console input/output operations. Code Implementation: ITemperatureConverter internal interface ITemperatureConverter { TemperatureUnit ReadConvertUnit(string baseUnit); bool IsInputValid(string baseValue, TemperatureUnit baseUnit, TemperatureUnit targetUnit); decimal Process(string baseUnitValue, TemperatureUnit baseUnitEnum, TemperatureUnit targetUnitEnum); } TemperatureDataService Read user input public TemperatureUnit ReadConvertUnit(string inputUnit) { if (!int.TryParse(inputUnit, out var unit)) { Console.WriteLine("Invalid temperature unit. Please enter convert unit: "); inputUnit = Console.ReadLine(); ReadConvertUnit(inputUnit); ...

Palindrome Checker

Image
C# Exercise: Palindrome Checker C# Exercise: Palindrome Checker Description Write a C# program that checks if a given string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward, ignoring spaces, punctuation, and capitalization. For example, "radar" and "A man a plan a canal Panama" are palindromes. Program.cs Console.WriteLine("Enter a text to check if it is a palindrome"); var text = Console.ReadLine(); var check = new PalindromeChecker.Class.PalindromeChecker(); if (string.IsNullOrEmpty(text)) Console.WriteLine("Text value empty"); if (check.IsPalindrome(text)) Console.WriteLine($"'{text}' is a palindrome"); else Console.Writ...
Image
C# Exercise: Fibonacci Sequence C# Exercise: Fibonacci Sequence Description Write a C# program to generate the Fibonacci sequence up to a specified number of terms. The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones, usually starting with 0 and 1. For example, the first few numbers in the Fibonacci sequence are 0, 1, 1, 2, 3, 5, 8, 13, 21, ... Your program should prompt the user to enter the number of terms they want in the Fibonacci sequence and then output the sequence up to that number of terms. Exercise Console.WriteLine("Enter the number of terms for the Fibonacci sequence:"); var numTerms = Convert.ToInt32(Console.ReadLine()); var iteration = 0; var firtNumber = 0; var secondNumber = 1; var nextNumber = 0; ...

CardHolder - business card storage application

Image
Problem      Throughout my career, I met many professionals in their respective fields and exchange a few words, and obtained their business cards as well. I used to store them in my cardholder or simply in my cupboard but it was quite frustrating to find a specific business card of someone when you need their services. moreover, there was quite some more annoying situation where I was not at home and don't have any business card at my reach but badly need to contact someone to reach out for their services so bearing in mind that modern problem requires modern solution I decided to create my own application which will solve the issue to store, search and carry all those business cards around. Solution my first solution was to download an already existing application, but some were paid application some were freemium and all of them did not have the specific feature that I want to use in my day to day basis  I started creating prototypes using two Xamarin which is a c...

Asymmetric cryptography using Angular 9 and Asp.net Web Api

Image
Introduction Nothing better than to learn something new during our free time. A new programming language, why not. Thus to make my mind busy as a geek i tried to learn Angular 9 and create a small application nothing fancy at all and called it Asymmetric cryptography. In simple words using Angular 9 to create the client side application and hooked it up with an ASP.NET web api. To conclude i deployed the application on Microsoft azure. How it works Key generation Asymmetric cryptography uses 2 key pairs to encryption  and decryption data. The 2 keys consist of a private key and a public key. To produce a cipher text (encryption), the public key alongside with the plain text will be used. In the same way, in order to produce a plain text (decryption) the cipher text will be used with the private key. The images below illustrate how asymmetric cryptography works: To use the application first select the key length namely: 512 bit 1024 bit 2048 bit 4096 bit...

Occupational therapy application for Dr. R.Seedhoo

Image
Introduction During my visit to ENT hospital Mauritius, I met Dr. R.Seedho, a senior occupational therapist. We had several meetings where we discussed the flow of operation, existing problem and why he wants to go forward with creating a custom made application to meet his needs. Based on the fact that Dr. R.Seedho wanted a system that will run only in his machine and must be able to do so with or without an internet connection, thus we decided to create a desktop application. After some prototyping, hours of coding and testing I created the application which Dr. R.Seedho was really pleased with the outcome and even better than he expected. How it works Main menu In order to achieve the best user experience I have decided to keep the main menu and navigation bar as simple as possible with the following menu: Appointment: view today's appointment and search for appointment. New appointment: add new patients with details such as medical records, range of motion, pre...

Face recognition using EmguCV 3.0 and typing pattern recognition

Image
Introduction An MSc project with the title Student Examination System, where the objective is to put the students in an examination condition but instead of having an invigilator in an examination center, the system will cater for the proper ongoing of the exam. the system can be used as an online examination system The system is able to: Recognizing the face shape of a particular student Detect if there is more than one person in the examination room  Analyze the typing pattern of a student and detect if any one person is taking part in the exam voice recognition for the student and detect if there is more than one person speaking in the examination room Setup Download Emgu CV from  http://www.emgu.com/wiki/index.php/Main_Page Download Haarcascade from  https://github.com/opencv/opencv/tree/master/data/haarcascades Create an account at  https://www.keytrac.net/ Face recognition The snippet below illustrates how the Emgu CV is loaded whe...

Login/Sign up and authentication process - Asp.net Web API, C#, Android Application, SQL server

Image
Implement Login/Sign up and authentication process to demonstrate my skills and understanding using technologies like ASP.NET C#, WebApi, Java and SQL server Tools Microsoft Visual Studio 2017 or latest Android Studio SQL server 2017 No-IP desktop application Additional Information and plugin To register For NO-IP service  Here For the tutorial on NO-IP and forwarding rule, click  Here To download and install UNITY.WEBAPI for repository pattern and dependency injection in ASP.NET WebApi click  Here Creating projects, solution and database Android studio Step 1 Step 2 Step 3 Visual Studio 2017 Step 1: Create a new project Step 2: Install Unity.WebAPI Open "Package manager console " and paste the following command SQL server Step 1: Create a database Right click on database folder in SQL server from the context menu select New Database Step 2: Login  Right cl...