This repository contains my solutions for Quiz 2 in C#.
The focus of this activity is practicing properties, encapsulation, and data validation using get and set accessors.
- Property validation using conditions
- String length checking using
.Length - Numeric constraints (min/max rules)
- Data masking (PIN and ID protection)
- Controlled updates using logic rules
- Value clamping between ranges
Accepts values only between 1 and 10.
Only accepts usernames with exactly 10 characters.
Prevents stock values above 10.
4. Hidden PIN
Stores a 4-digit PIN and displays it as masked output.
Ensures price never goes below 10.
Allows updates only if the new value increases by exactly 10.
Stores a 10-character ID and displays only the last 4 digits.
Prevents level from decreasing.
Keeps values between 0 and 100.
- C#
This activity helped me understand how to:
- Control data inside classes
- Protect variables using encapsulation
- Apply validation rules in setters
- Build safer and cleaner object-oriented code