Question 1You are trying to teach your 12-year-old son about Object Oriented Programming benefits. You are
unable to convince him that “class” fields should be private and not public, because he wants to access
them without the help of any other methods and all by using object. You ultimately surrender and say
that ok lad you can access them like public members but can’t declare them public.
What solutions you might propose to him? Write a maximum of one-liner for solution proposal along
with a very short code representing the importance of your solution.
Question 2
You professor gave you an assignment to make a “book management system”. You were required to use
the basic filing system in C#. When you submitted the assignment, the project was not working good for
your professor. He gave feedback that you have not used the right addressing for your files, therefore,
professor is not able to see the created files/or create new files as expected in the program.
Can you highlight what might be an issue here? Try to be concise as much as possible, infract your
answer should not exceed 3 lines.
Question 3
Add a label, textbox, and button to the Question 3 groupbox as follows:
If the user has entered a valid license number in Ontario, clicking the button should prompt a
MessageBox indicating so. Conversely, if the entered text is not a valid license number, the
MessageBox should indicate that as well.
● 1 letter (AEIOU) followed 4 digits
● Optionally a space or a dash
● 5 digits
● Optionally a space or a dash
● 5 digits
So, for example, A4567- 33112- 90831 is a valid licence card. Also, E12571234512345 is a valid licence
card number. But 4567- 3312- 90831 is not a valid one.
Question 4 asi
Develop the form further, in the Question 4 group box, to allow users to record patient information. To
do so, the UI needs:
●
●
●
3 input textboxes to enter patient information
A button to record the new patient
A listBox to display all patients name.
To receive full marks for this question you must utilize:
●
●
●
●
A class to represent patients using overloaded constructors as well as properties to define the
fields.
Exception handling in that class to indicate invalid data
ErrorProviders to indicate error icons while user leaves either the field empty or enters wrong
information.
A single array of 10 values to store 10 patients.
This should look as follows:
More specifically, users should be able to:
●
Enter the following data about each patient to be recorded:
○ Patient’s full name:
■ In first and last name format
■ This field is required
○ Age of the patient:
■ This field is also required
■ The age cannot be negative
●
Record the patient by clicking “ADD PATIENT” button. However, the following constraints must
be met:
○ The input fields should be used to instantiate an object of the Patient class you have
defined.
○ The patients recorded should be stored in a single array – For simplicity’s sake, only
define an array of 10 patients.
○
●
If a patient is recorded successfully, then a message box should inform the user of that
fact.
○ If, on the other hand, there are any validation failures, then the errors, should be shown
in message box. Or errorProviders are set with appropriate messages.
○ When the patient is successfully added, his/her name should be added to the listbox
collection.
Display the patients:
○ When use clicks on any specific patient’s name in the listbox, that patient’s information
is displayed in the text boxes. The following is an example: Consider three patients are
added here, Alan, Bob, and Christina.