Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Open your existing GameConsole application Validation.cs Create a new method to validate user input against a dynamic list of approved answers. Note : Think of
Open your existingGameConsoleapplication
Validation.cs
- Create a new method to validate user input against a dynamic list of approved answers. Note: Think of this like drop-down menu on a website form. Ex: when asking for a month, there are only 12 acceptable responses, anything else is invalid.
Users.txt
- Create a text document to hold user information:username,password,age, andtheme
- Pre-populate this with a few users (3+)
User.cs
- Create a login method, belonging to the class, not a particular object... This should return an instantiated object based on a successful comparison to the users.txt file Note: Think of this like a bouncer or host at a fancy restaurant. You walk up and give them your name.... try breaking it down step-by-step, how does the host know if you are allowed in. They have a file containing reservations, and you have a text-file containing registered users.
- Add another method allowing for the saving of new users. Use the newly created validation method to validate the user inputed theme... lightanddark are the only current themes.
Program.cs
- Instead of simply instantiating a user object with hard-coded values, use the login method to set the current user.
- If necessary, the store logged-in user so that it's accessible within other classes. We want to prevent the user from having to login each time they are returned to the 'home screen'.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
csharp Validationcs using System using SystemCollectionsGeneric namespace GameConsole public static ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started