Project · C# and .NET
Project: a clinic appointment book
The brief
Sharma Clinic in Jaipur books patients into fixed slots with two doctors. You build an AppointmentBook class that refuses double bookings with a custom exception, lists a doctor's day with LINQ, totals fees per doctor, saves to a JSON file and loads it back, and then prove it with a set of given xUnit tests.
Why it matters
Booking systems for clinics, salons, coaching classes and service centres are everyday .NET work. The pattern here, a class that guards its own rules, LINQ for reports, JSON for storage and tests that prove the rules, is the same one used in much larger hospital and practice-management software.
Skills you practise
- classes and encapsulation
- records
- custom exceptions
- List<T> and LINQ (Where, OrderBy, GroupBy, Sum)
- async file I/O
- System.Text.Json
- running xUnit tests
You need
- .NET 8 SDK or newer
- A code editor (VS Code with the C# Dev Kit, Visual Studio or Rider)
What you will have at the end
The ClinicWork folder with the Clinic console app (AppointmentBook, records, a custom exception, LINQ reports and JSON storage) and the Clinic.Tests project with six passing tests.
How it is marked (rubric, 100 points)
| Rules enforcedDouble bookings are refused with SlotTakenException before anything is added; all six tests pass. | 35 |
|---|---|
| LINQ and reportsForDoctor and FeesByDoctor use Where, OrderBy/ThenBy, GroupBy and Sum, and the output is sorted. | 25 |
| StorageJSON is saved and loaded with one reused options object; a missing file gives an empty book, not a crash. | 20 |
| Design and styleThe list stays private, records are used for values, and names follow C# conventions. | 20 |
0/7 steps done
Step 1 of 7
Set up the project
A Clinic console project inside a ClinicWork folder holds Program.cs and AppointmentBook.cs and builds.
Make a ClinicWork folder and create the console project inside it, so that the test project you add in step 7 can sit next to it (a project inside another project's folder would be compiled twice). Copy Program.cs and AppointmentBook.cs from this project into the Clinic folder, replacing the template's Program.cs. Every .cs file in the project folder is compiled, so the class needs no extra setup. You may see a warning about an unused field or method at this point; warnings do not stop the build.
mkdir ClinicWork
cd ClinicWork
dotnet new console -o Clinic
dotnet build Clinic
dotnet run --project Clinic$ mkdir ClinicWork
cd ClinicWork
dotnet new console -o Clinic
(copy Program.cs and AppointmentBook.cs into Clinic)
dotnet build ClinicYour notes: Program.cs, AppointmentBook.cs
Write down each command you ran. It goes into your project summary.