Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“˜ QUIZ.2 – C# Properties and Validation

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.


🧠 Topics Covered

  • 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

🧩 Exercises Included

1. Age Bracket

Accepts values only between 1 and 10.

2. Username (10 Characters)

Only accepts usernames with exactly 10 characters.

3. Stock Limit

Prevents stock values above 10.

4. Hidden PIN

Stores a 4-digit PIN and displays it as masked output.

5. Price Floor

Ensures price never goes below 10.

6. Score Incrementer

Allows updates only if the new value increases by exactly 10.

7. ID Masking

Stores a 10-character ID and displays only the last 4 digits.

8. Level Lock

Prevents level from decreasing.

9. Percent Clamp

Keeps values between 0 and 100.


πŸ’» Language Used

  • C#

πŸ“Œ Learning Outcome

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages