Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions 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
expand button
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!"));
}
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education