You have met .NET, written C# syntax, stored variables, branched with if-else, and modelled a bank account as a class. Theory is useful — but nothing beats building something that runs on your machine and responds when you type.
Today we build a Tip Calculator console app: you enter a restaurant bill, pick a tip percentage, and the program prints the total. Small project, big confidence boost.
What Is a Console App?
A console application runs in a text window (terminal) instead of a graphical UI. No buttons or animations — just input and output lines.
That sounds old-fashioned, but console apps are perfect for learning, automation scripts, and backend tools. Many banking batch jobs that calculate interest overnight are console programs scheduled by the server — like a night shift worker who never needs a fancy desk.
Project Structure
When you run dotnet new console, you get:
Program.cs— your C# codeTipCalculator.csproj— project settings (target .NET version, packages)obj/andbin/— build output (auto-generated, ignore for now)
dotnet new console
↓
Program.cs + .csproj created
↓
dotnet run compiles and executes
↓
Output appears in terminal
Step-by-Step Build
Step 1: Create the project.
dotnet new console -n TipCalculator
cd TipCalculator
Step 2: Replace Program.cs with our app logic:
Console.WriteLine("=== Restaurant Tip Calculator ===");
Console.Write("Enter bill amount (Rs): ");
string input = Console.ReadLine() ?? "0";
double bill = double.Parse(input);
Console.Write("Tip percentage (e.g. 10): ");
int tipPercent = int.Parse(Console.ReadLine() ?? "0");
double tipAmount = bill * tipPercent / 100.0;
double grandTotal = bill + tipAmount;
Console.WriteLine();
Console.WriteLine("Bill: Rs " + bill.ToString("F2"));
Console.WriteLine("Tip (" + tipPercent + "%): Rs " + tipAmount.ToString("F2"));
Console.WriteLine("Total: Rs " + grandTotal.ToString("F2"));
Step 3: Run it.
dotnet run
Step 4: Test with bill 500 and tip 10. You should see total Rs 550.00.
Adding a Class (Lesson 5 Review)
Refactor calculation into a class so logic stays organized — the way real teams structure code:
class BillSummary
{
public double Bill { get; init; }
public int TipPercent { get; init; }
public double TipAmount => Bill * TipPercent / 100.0;
public double Total => Bill + TipAmount;
}
// Usage after reading input:
var summary = new BillSummary { Bill = bill, TipPercent = tipPercent };
Console.WriteLine("Total: Rs " + summary.Total.ToString("F2"));
Same behaviour, cleaner separation. The console handles input/output; BillSummary handles math.
Real-World Connection
Food delivery backends use the same pattern: read order data, apply business rules in classes, return a receipt JSON instead of console text. You are practising the skeleton professionals use — input, process, output — just with simpler technology.
Common Misconceptions
"Console apps are not real programming." They are real .NET apps. ASP.NET Core APIs follow similar project layout without the console window.
"I should delete obj and bin folders manually every time." Usually unnecessary. Run dotnet clean if builds act strange.
"Parse never fails." If the user types "abc" instead of a number, double.Parse throws an error. Lesson 10 covers handling that gracefully.
"One file is enough forever." For learning, yes. Growing apps split classes into separate files — BillSummary.cs, Program.cs, etc.
Quick Recap
dotnet new consolescaffolds a project.dotnet runbuilds and executes.Console.ReadLine()reads user text input.- Combine variables, parsing, and classes into one working app.
- Test with realistic numbers before celebrating.
Summary
You just closed the loop from platform concept to running software. Like finishing your first solo drive after weeks of theory — the route was short, but you did it yourself.
Lesson 7 opens the web door: ASP.NET Core turns your C# skills into APIs that mobile apps and browsers can call.
Frequently Asked Questions
Program.cs, a .csproj file, and default build configuration.Program.cs — either top-level statements or a Main method where execution starts.Console.ReadLine() to capture text the user types, then parse it to numbers if needed.dotnet publish outputs files you can deploy to a server or share as a standalone executable.Key Takeaways
- Console apps are the simplest way to run C# on your machine.
dotnet newanddotnet runare your daily commands.- Combine input, variables, logic, and classes in one project.
- Refactoring into classes keeps code maintainable.
- You now have a complete mini-app — not just isolated examples.