using System; 2 using UserNamespace; // namespace 3 4 5 namespace UserNamespace 6 + { 7 8 9 // User class definition public abstract class User { // instance variables private string user_id; // user id protected string user_password; // user password // parametrized constructor public User (string id, string pass) { user_id = id; user_password = pass; } // verifyLogin method to verify the login cresentials public bool verifyLogin(string id, string pass) { // return true, if matches // otherwise, return false return user_id.Equals(id)&&user_password. Equals(pass); } // abstract method public abstract void updatePassword(string newPassword); // Administrator clas definition public class Administrator: User { // instance variable private string admin_name; // name of admin // parametrized constructor public Administrator (string name, string id, string pass):base (id, pass) admin_name = name; 38 } 39 // updatePassword method to update the password of user public override void updatePassword (string newPassword) 40 41- { 42 user_password = newPassword; 43 } // updateAdminName method to update the name of the admin public void updateAdminName(string name) 45 46- { 47 admin_name = name; 48 } 49 50 51 // Testing class definition 52 public class Testing 53- 54 // main method 55 public static void Main() 56 { 57 // create an object of Administrator class 58 Administrator a = new Administrator ("Katty","kat123","katty123!"); // print the result 59 50 Console.WriteLine(a.verifyLogin("kat123","katty123!")); 51 52 10 11 12 13 14 15- 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36- 37
using System; 2 using UserNamespace; // namespace 3 4 5 namespace UserNamespace 6 + { 7 8 9 // User class definition public abstract class User { // instance variables private string user_id; // user id protected string user_password; // user password // parametrized constructor public User (string id, string pass) { user_id = id; user_password = pass; } // verifyLogin method to verify the login cresentials public bool verifyLogin(string id, string pass) { // return true, if matches // otherwise, return false return user_id.Equals(id)&&user_password. Equals(pass); } // abstract method public abstract void updatePassword(string newPassword); // Administrator clas definition public class Administrator: User { // instance variable private string admin_name; // name of admin // parametrized constructor public Administrator (string name, string id, string pass):base (id, pass) admin_name = name; 38 } 39 // updatePassword method to update the password of user public override void updatePassword (string newPassword) 40 41- { 42 user_password = newPassword; 43 } // updateAdminName method to update the name of the admin public void updateAdminName(string name) 45 46- { 47 admin_name = name; 48 } 49 50 51 // Testing class definition 52 public class Testing 53- 54 // main method 55 public static void Main() 56 { 57 // create an object of Administrator class 58 Administrator a = new Administrator ("Katty","kat123","katty123!"); // print the result 59 50 Console.WriteLine(a.verifyLogin("kat123","katty123!")); 51 52 10 11 12 13 14 15- 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36- 37
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 1CP: In previous chapters, you have created programs for the Greenville Idol competition. Now create a...
Related questions
Question
100%
Can you please fix the code ? see picture for error thank you
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT