C# Console Programming
Project workbook · Path 79

Create a C# console exercise that validates seat counts, calculates totals and prints a structured summary.

The case

A fictional workshop receives seat requests 2, 1, 5 and 3. Accept integers from 1 to 4. Each accepted seat costs 12 teaching units. Reject 5 and report accepted requests, accepted seats and total value. The exercise does not collect money.

RequestSeats
A2
B1
C5
D3
STAGE 1

Read and run the basics

Start with variables whose names and types express the case. Print a known result before adding loops or validation. Use the provider’s current modules through the published course link; local SDK setup can differ by operating system. Record the actual version if you run the project.

Your task

Create a console project and print the price and allowed range.

Required output

Starter program

Record your result and evidence here or in a separate file.

Review gate

The program builds in the learner’s local environment or the setup blocker is recorded honestly.

If the gate is not met

Resolve SDK setup before treating a source file as a successful run.

STAGE 2

Express the validation rule

A small predicate makes the allowed range explicit. Reject invalid values before including them in totals. If input starts as text, use a parse method that can report failure rather than throwing for an ordinary mistake. Keep parsing and business validation separate so their failures can be explained.

Your task

Write IsValidSeats and test 0, 1, 4 and 5.

Required output

Validation function

Record your result and evidence here or in a separate file.

Review gate

Only 1 and 4 pass those four boundary tests.

If the gate is not met

Use inclusive lower and upper comparisons.

STAGE 3

Aggregate accepted requests

Maintain counts for accepted and rejected requests separately from the sum of seats. A count of requests is not a count of seats. Calculate value from accepted seats only. The data are tiny integers, so the example does not attempt currency rounding or a financial ledger.

Your task

Loop over the four requests and calculate the three summary values.

Required output

Aggregation program

Record your result and evidence here or in a separate file.

Review gate

Accepted requests=3, rejected=1, seats=6 and value=72.

If the gate is not met

Trace each row and update totals only inside the valid branch.

STAGE 4

Handle malformed input

A robust console exercise should explain malformed text and continue or stop according to a documented policy. Avoid silent coercion. This case uses a fixed fixture for deterministic checks and an optional interactive extension. Keep expected output with the source so a reviewer can compare a real execution.

Your task

Add a non-integer input case and document the response.

Required output

Error-handling demonstration

Record your result and evidence here or in a separate file.

Review gate

Malformed text is not treated as zero accepted seats.

If the gate is not met

Use an explicit parse-failure branch.

STAGE 5

Package the program

A complete handoff includes source, run commands, expected output and the actual execution status. A file is not evidence that a compiler ran. This preparation environment does not have the .NET SDK, so the bundled source is a learner-run reference with checks to perform locally.

Your task

Write the README and record local compile and run results when available.

Required output

Console project handoff

Record your result and evidence here or in a separate file.

Review gate

The status accurately distinguishes supplied source from executed evidence.

If the gate is not met

Do not copy the expected output into an execution log.

Final project

Deliver the console source, boundary cases, malformed-input behavior, expected output and a real local run log when available. Extend the price to 13 and explain the changed total.

Critical condition

Invalid requests never contribute to totals and expected output is not mislabeled as executed output.

CriterionPointsEvidence
Evidence and correctness30Calculations, source use and results match the supplied case; limitations are honest.
Required artifacts30All five stage outputs and the capstone handoff are present and inspectable.
Reasoning and decisions20Choices, assumptions, alternatives and the case-specific critical condition are explained.
Reproducibility10A reviewer can follow the stated steps and distinguish expected from observed results.
Clear communication10Labels, units, structure and evidence references make the work easy to review.

Score at least 80/100, supply every required artifact, and satisfy the path-specific critical condition. Rework missing evidence before marking complete.

Worked reference

Requests 2, 1 and 3 pass; 5 fails. Accepted requests are 3, seats total 6 and value is 72. The package includes a C# reference and expected checks. .NET execution was not performed in the preparation environment.

Boundaries

This provides a local educational source project, not a compiled application, payment system or cloud deployment.