Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

227 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C# .NET Practice Exercises

.NET Build

Welcome to the CSharpPractice repository! This repository contains a structured collection of exercises and practice programs for mastering C# and .NET development, mapped chapter-by-chapter from foundational concepts to advanced concurrent programming.

🛠️ Getting Started

Prerequisites

Running a Project

To open and work with these exercises, open the main solution file CSharpPractice.sln in your preferred IDE, or use the .NET CLI:

# Clone the repository
git clone https://github.com/HappyMagabane/CSharpPractice.git

# Navigate into the folder
cd CSharpPractice

# Restore dependencies
dotnet restore

# Run a specific project (replace with project folder name)
dotnet run --project BasicVariables/BasicVariables.csproj

📚 Repository Map & Exercises Index

Below is the structured list of all practice topics and their corresponding projects in this repository:

Chapter 1: Variables

Chapter 2: Operators

  • AssignmentCounter - Arithmetic Operators: Implement a AssignmentCounter program using the += operator to increment the counter on variable counter with each iteration. Before each increment, print the counter as shown above. NB: Using While Statement.
  • CompareNumber - Comparison Operators: Write a program CompareNumber that compares two numbers (number1 and number2) entered by the user and displays whether the first number is greater, less than, or equal to the second number. Using If else statement
  • ComparePassword - Comparison Operators: Implement a program ComparePassword that checks if a user-entered password userPassword matches a predefined constant PASSWORD initialized with myPass@2023 using the equality (=) operator. NB: Using If statement
  • LogicInRange - Logical Operators: Write a program LogicInRange that checks if a number entered by the user is within a specified range (e.g., between 1 and 100) using logical operators (And, Or, Not). NB: Using If statement
  • LogicPass - Logical Operators: Implement a program LogicPass that checks if a student's mark is passing (greater than or equal to 60) and whether their attendance is satisfactory (at least 80% attendance) using logical operators. NB: Using If statement
  • SimpleCalculator - Arithmetic Operators: Write a program (SimpleCalculator) that performs arithmetic operations (addition, subtraction, multiplication, division, modulus, exponent) on two numeric variables which entered by prompting user.
  • TernaryMaximum - Logical Operators: Implement a program LogicPass that checks if a student's mark is passing (greater than or equal to 60) and whether their attendance is satisfactory (at least 80% attendance) using logical operators. NB: Using If statement

Chapter 3: Strings

  • AccessStringCharacters - Accessing Strings: Write a AccessStringCharacters program that asks the user to enter a word. Display the first and last letter of the word.
  • CharacterMethods - Accessing Strings: Write a program CharacterMethods which enters a single character and determine if it’s the letter, digit, white space, uppercase, lowercase, both letter and number.
  • FirstLettersDisplay - Typical Programs: Name Initials: Write a program that asks the user to enter a name (which contact first and middle). Display their initials based on the name entered.
  • StringMethods - General Exercises: Write a program called StringMethods that perform the following using their respective above-mentioned methods:

Chapter 4: Selection Control Statement

  • IfAdultProgram - General Exercises: Write a program IfAdult that asks the user to enter their age. If the age is greater than or equal to 18, display a message indicating they are an adult; otherwise, display a message indicating they are a minor.
  • IfCredentials - General Exercises: Create a program IfCredentials that asks the user to enter their username and password. If both are correct, display a welcome message; otherwise, display an error message.
  • IfLeapYearProgram - General Exercises: Write a program IfLeapYear that checks if a user-entered year is a leap year. If it is, display a message indicating it's a leap year; otherwise, display a message indicating it's not. Use IsLeapYear() method.
  • IfPositiveNumber - General Exercises: Implement a program ifPositiveNumber that checks if a user-entered number is positive, negative, or zero using If-Else statements.
  • SelectionIfTriangle - Selection Control with Boolean Expressions: Write a SelectionIfTriangle program that asks the user to enter three numbers and checks if they form a valid triangle (the sum of any two sides is greater than the third side). Display the result using If-Else statements.
  • SelectionWithdraw - Selection Control with Boolean Expressions: Create a SelectionWithdraw program that simulates a simple ATM. Ask the user to enter their account balance and check if it's greater than zero. If it is, allow them to withdraw money; otherwise, display an error message.
  • SwitchDayOfTheWeek - Switch Statements: Implement a program SwitchDayOfTheWeek that asks the user to enter a day of the week (1 for Monday, 2 for Tuesday, etc.) and then displays the corresponding name of the day using a Switch statement.
  • SwitchMonthProgram - Switch Statements: Write a program SwitchMonth that converts a user-entered month number (1 for January, 2 for February, etc.) into the corresponding month name using a Switch statement.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages