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

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
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...
icon
Related questions
Question
100%

Can you please fix the code ? see picture for error thank you

Result
CPU Time: 0.02 sec(s), Memory: 16348 kilobyte(s)
Compilation succeeded - 1 warning(s)
True
jdoodle.cs(33,24): warning CS0414: The private field `UserNamespace. Administrator.admin_name' is assigned but its value is never used
Transcribed Image Text:Result CPU Time: 0.02 sec(s), Memory: 16348 kilobyte(s) Compilation succeeded - 1 warning(s) True jdoodle.cs(33,24): warning CS0414: The private field `UserNamespace. Administrator.admin_name' is assigned but its value is never used
1 using System;
2 using UserNamespace;
// namespace
3
4
5 namespace UserNamespace
6 {
7
8
Nm tin c
LO CO
9 ▾
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
38
39
40
41-
42
43
44
45
46 -
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// 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;
}
// updatePassword method to update the password of user
public override void updatePassword(string newPassword)
{
user_password = newPassword;
}
// updateAdminName method to update the name of the admin
public void updateAdminName(string name)
admin_name name;
}
}
// Testing class definition
public class Testing
// main method
public static void Main()
// create an object of Administrator class
Administrator a = new Administrator ("Katty","kat123","katty123!");
// print the result
Console.WriteLine(a.verifyLogin("kat123","katty123!"));
}
Transcribed Image Text:1 using System; 2 using UserNamespace; // namespace 3 4 5 namespace UserNamespace 6 { 7 8 Nm tin c LO CO 9 ▾ 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 38 39 40 41- 42 43 44 45 46 - 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 // 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; } // updatePassword method to update the password of user public override void updatePassword(string newPassword) { user_password = newPassword; } // updateAdminName method to update the name of the admin public void updateAdminName(string name) admin_name name; } } // Testing class definition public class Testing // main method public static void Main() // create an object of Administrator class Administrator a = new Administrator ("Katty","kat123","katty123!"); // print the result Console.WriteLine(a.verifyLogin("kat123","katty123!")); }
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Unreferenced Objects
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT