Code with Fatima

1-on-1 and group C# coaching to help you go from beginner to confident developer. Learn real-world coding, build projects, and level up...
Faisalabad, PK
โ€ขCreated byProfile pictureFatima_younas
1 joined
Profile picture
Fatima_younasProfile picture@fatimayounas1ยทMay 20

C# mein headphone post! ๐ŸŽง

Is code mein C# ke concepts hain:

Class โ€” Headphone class banayi

Properties โ€” BrandName, Price, BatteryLife, etc.

Constructor โ€” object banate waqt values set hoti hain

Method โ€” ShowPost() jo post display karta hai

Object โ€” Main() mein myHeadphone object banaya

Console Colors โ€” Yellow, Cyan, Green se colorful output

Run kaise karein:

dotnet run

Ya Visual Studio mein open karke F5 press karo.

Customize karna ho toh sirf yeh values badlo:

brandName: "Apna Brand",

productName: "Apna Product",

price: 199.99,

Koi aur cheez samajhni ho toh puchh lo! ๐Ÿ˜Š

using System;

namespace HeadphonePost

{

class Headphone

{

// Properties

public string BrandName { get; set; }

public string ProductName { get; set; }

public string Model { get; set; }

public int BatteryLife { get; set; }

public bool HasANC { get; set; }

public string AudioCodec { get; set; }

public int Impedance { get; set; }

public double Price { get; set; }

public string Badge { get; set; }

// Constructor

public Headphone(string brandName, string productName, string model,

int batteryLife, bool hasANC, string audioCodec,

int impedance, double price, string badge)

{

BrandName = brandName;

ProductName = productName;

Model = model;

BatteryLife = batteryLife;

HasANC = hasANC;

AudioCodec = audioCodec;

Impedance = impedance;

Price = price;

Badge = badge;

}

// Method - Post display karo

public void ShowPost()

{

Console.Clear();

// Colors set karo

Console.BackgroundColor = ConsoleColor.Black;

Console.ForegroundColor = ConsoleColor.Yellow;

Console.WriteLine();

Console.WriteLine(" โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—");

Console.WriteLine($" โ•‘ {BrandName,-30} [{Badge}] โ•‘");

Console.WriteLine(" โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ");

// Headphone ASCII art

Console.ForegroundColor = ConsoleColor.DarkYellow;

Console.WriteLine(" โ•‘ โ•‘");

Console.WriteLine(" โ•‘ .---. .---. โ•‘");

Console.WriteLine(" โ•‘ / \\___/ \\ โ•‘");

Console.WriteLine(" โ•‘ | (o) | (o) | โ•‘");

Console.WriteLine(" โ•‘ \\_____/ \\_____/ โ•‘");

Console.WriteLine(" โ•‘ โ•‘");

// Product name

Console.ForegroundColor = ConsoleColor.White;

Console.WriteLine($" โ•‘ Product : {ProductName} {Model,-20} โ•‘");

// Specs

Console.ForegroundColor = ConsoleColor.Yellow;

Console.WriteLine(" โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ");

Console.WriteLine(" โ•‘ SPECIFICATIONS โ•‘");

Console.WriteLine(" โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ");

Console.ForegroundColor = ConsoleColor.Cyan;

Console.WriteLine($" โ•‘ ๐Ÿ”‹ Battery Life : {BatteryLife} Hours{"",-22}โ•‘");

Console.WriteLine($" โ•‘ ๐ŸŽต Audio Codec : {AudioCodec,-25}โ•‘");

Console.WriteLine($" โ•‘ ๐Ÿ”‡ Noise Cancel : {(HasANC ? "YES (Active ANC)" : "No"),-25}โ•‘");

Console.WriteLine($" โ•‘ ๐ŸŽง Impedance : {Impedance} Ohm{"",-22}โ•‘");

// Price

Console.ForegroundColor = ConsoleColor.Yellow;

Console.WriteLine(" โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ");

Console.ForegroundColor = ConsoleColor.Green;

Console.WriteLine($" โ•‘ ๐Ÿ’ฐ Price : ${Price:F2}{"",-24}โ•‘");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.WriteLine(" โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ");

// Tagline

Console.ForegroundColor = ConsoleColor.Magenta;

Console.WriteLine(" โ•‘ โœจ Feel Every Frequency โœจ โ•‘");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.WriteLine(" โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•");

Console.ResetColor();

Console.WriteLine();

}

}

class Program

{

static void Main(string[] args)

{

// Headphone object banao

Headphone myHeadphone = new Headphone(

brandName: "SoundLux Audio",

productName: "NOVA PRO X",

model: "2025",

batteryLife: 40,

hasANC: true,

audioCodec: "HD Audio",

impedance: 32,

price: 249.99,

badge: "NEW DROP"

);

// Post show karo

myHeadphone.ShowPost();

Console.ForegroundColor = ConsoleColor.DarkGray;

Console.WriteLine(" Press any key to exit...");

Console.ResetColor();

Console.ReadKey();

}

}

}

Profile picture
Fatima_younasProfile picture@fatimayounas1ยทMay 8

๐ŸŽฏ Program Kya Hai?

Yeh ek C# Console Application hai jo ek real LED bulb ki tarah kaam karta hai โ€” sirf screen par! Jaise real life mein switch dabate hain aur LED jalta/bujhta hai, bilkul usi tarah yeh program kaam karta hai.

๐Ÿ”„ Program Ka Flow

Program Start

โ†“

Menu Display hota hai

โ†“

User choice enter karta hai

โ†“

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”

โ”‚ 1 โ†’ LED ON ๐Ÿ’ก (Yellow) โ”‚

โ”‚ 2 โ†’ LED OFF โšซ (Dark) โ”‚

โ”‚ 3 โ†’ Blink โ˜…โ˜† (5 baar) โ”‚

โ”‚ Q โ†’ Program Band โ”‚

โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ†“

LED Status Screen par dikhta hai

โ†“

Loop chalta rehta hai jab tak Q na dabao

๐Ÿง  Concepts Used

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”

โ”‚ CONCEPTS EXPLAINED โ”‚

โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค

โ”‚ bool ledOn โ”‚ LED ki state store โ”‚

โ”‚ โ”‚ karta hai (on/off) โ”‚

โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค

โ”‚ while(true) โ”‚ Program continuously โ”‚

โ”‚ โ”‚ chalta rehta hai โ”‚

โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค

โ”‚ if/else if โ”‚ User ki choice check โ”‚

โ”‚ โ”‚ karta hai โ”‚

โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค

โ”‚ Thread.Sleep() โ”‚ Blink mein delay โ”‚

โ”‚ โ”‚ deta hai โ”‚

โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค

โ”‚ Console. โ”‚ Text ka color โ”‚

โ”‚ ForegroundColor โ”‚ change karta hai โ”‚

โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค

โ”‚ for loop โ”‚ 5 baar blink โ”‚

โ”‚ โ”‚ karvata hai โ”‚

โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ’ป Screen Display

LED OFF hone par:

. . . . .

. .

. โ—‹ OFF .

. .

. . . . .

Status: [ LED OFF โšซ ]

LED ON hone par:

  • * * * *

  • *

  • ๐Ÿ’ก ON *

  • *

  • * * * *

Status: [ LED ON ๐ŸŸก ]

Blinking hone par:

Blink 1: โ˜… ON

Blink 1: โ˜† OFF

Blink 2: โ˜… ON

Blink 2: โ˜† OFF

...

โœ” Blinking Done!

๐Ÿ”‘ Key Functions

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”

โ”‚ Main() โ”‚

โ”‚ โ†’ Program ka main control yahan โ”‚

โ”‚ โ†’ User input leta hai โ”‚

โ”‚ โ†’ Choices handle karta hai โ”‚

โ”‚ โ”‚

โ”‚ DisplayLED(bool isOn) โ”‚

โ”‚ โ†’ Screen clear karke LED โ”‚

โ”‚ dikhata hai โ”‚

โ”‚ โ†’ ON = Yellow color โ”‚

โ”‚ โ†’ OFF = Dark Gray color โ”‚

โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ–ถ๏ธ Kaise Chalayein?

Step 1: Visual Studio open karo

Step 2: New Console App banao

Step 3: Code paste karo

Step 4: F5 dabao (Run)

Step 5: 1, 2, 3 ya Q press karo

๐Ÿ“ File Save Karo As:

LED_Simulation.cs

Yeh description + diagram tumhare exam ya assignment mein full marks dilayega! ๐Ÿ†๐Ÿš€

Profile picture
Fatima_younas@fatimayounas1ยทMay 8
Profile picture
Fatima_younasProfile picture@fatimayounas1ยทMay 8

Program Mein Use Hone Wale Concepts

Console.ReadLine() โ€” user se input lena

Convert.ToDouble() โ€” text ko number mein convert karna

if / else if / else โ€” grade decide karne ke liye

ToString("F2") โ€” average ko 2 decimal places mein dikhana

Example:Enter Student Name: Fatima

Enter Marks for Subject 1: 85

Enter Marks for Subject 2: 76

Enter Marks for Subject 3: 90

========== Student Result ==========

Student Name : Fatima

Subject 1 : 85

Subject 2 : 76

Subject 3 : 90

Total Marks : 251

Average Marks: 83.67

Grade : A

====================================

Profile picture
Fatima_younasProfile picture@fatimayounas1ยทMay 8

using System;

class StudentResult_YourName

{

static void Main(string[] args)

{

// Input

Console.Write("Enter Student Name: ");

string name = Console.ReadLine();

Console.Write("Enter Marks for Subject 1: ");

double sub1 = Convert.ToDouble(Console.ReadLine());

Console.Write("Enter Marks for Subject 2: ");

double sub2 = Convert.ToDouble(Console.ReadLine());

Console.Write("Enter Marks for Subject 3: ");

double sub3 = Convert.ToDouble(Console.ReadLine());

// Calculate

double total = sub1 + sub2 + sub3;

double average = total / 3;

// Determine Grade

string grade;

if (average >= 80)

grade = "A";

else if (average >= 70)

grade = "B";

else if (average >= 60)

grade = "C";

else

grade = "Fail";

// Display Result

Console.WriteLine("\n========== Student Result ==========");

Console.WriteLine("Student Name : " + name);

Console.WriteLine("Subject 1 : " + sub1);

Console.WriteLine("Subject 2 : " + sub2);

Console.WriteLine("Subject 3 : " + sub3);

Console.WriteLine("Total Marks : " + total);

Console.WriteLine("Average Marks: " + average.ToString("F2"));

Console.WriteLine("Grade : " + grade);

Console.WriteLine("====================================");

}

}

Student Result Management Program

๐Ÿ“‹ Program Description

Yeh ek Student Result Management Program hai jo C# programming language mein banaya gaya hai. Is program ka maqsad kisi bhi student ke teen subjects ke marks leke uska total, average aur grade automatically calculate karna hai.

Profile picture
Fatima_younasProfile picture@fatimayounas1ยทMay 3

Coding Tips & Updates mein:

C# ke basic tips

Coding tricks aur shortcuts

Project ideas for beginners

Error fix karne ke tips

Profile picture
Fatima_younasProfile picture@fatimayounas1ยทMay 3

5 things I wish someone told me when I started learning C#

Most C# tutorials throw you into syntax and theory. Here's what actually matters when you're starting out:


1. You don't need to understand everything before you build.

Start a project on day 1. A calculator, a to-do list โ€” anything. You learn by breaking things.


2. Console apps are underrated.

Before jumping into Unity or ASP.NET, get comfortable with console apps. They strip away the noise and let you focus on logic.


3. Debugging is a skill, not a chore.

Learn to use breakpoints and step through code early. It'll save you hours of guessing.


4. Don't memorize โ€” understand patterns.

Loops, conditionals, methods โ€” once you see the patterns, you can write anything.


5. Find someone who's a few steps ahead.

Not a guru. Just someone who recently solved the problems you're facing. That's what I do here.


I'm building a free community for C# learners. If you're serious about learning to code, come through.