Question help with some lines of code

Yusuf

New member
Joined
May 8, 2012
Messages
1
Programming Experience
Beginner
Create a class named Service. Inside the Service class, declare a class variable named Started. The datatype of this variable is Boolean.


VB.NET:
Public Class Service
Dim started as Boolean 
End Class
Create a class named Server. Inside the Server class, declare a dynamic array that can contain elements of the type Service.(Note: For convenience, both the array and the variable Started can be accessible from a client program
that creates an instance of Server and Service respectively)


Create a constructor for the Service class. When the constructor is executed, it will set the value of the class variable Started to True.


Create two new classes: WebServer and DatabaseEngine. Both of these classes inherit from the class Service.


Inside the Service class, declare a Sub procedure (method) named Terminate. This method should display
the following text “Service stopping…” in a message box when executed. This method can be overridden in classes that inherit from Service class.


Inside both the WebServer and DatabaseEngine class, override the method Terminate inherited from their base class Service. Both methods should first call the base class Terminate method. The messages “Web server stopping…” and “Database engine stopping…” should also be displayed in a message box when the Terminate method for the WebServer and DatabaseEngine are called respectively. These messages should only be displayed if the Started variable inherited from their base class is not equal to False.


Inside the Server class, declare a method named Shutdown. This method does not return any value. When executed, it will call the Terminate method for each of the Service instances (if any) in the arrServices
array. You should call the Terminate method within a For Each loop that loops through the elements of the arrServices array.


In the Sub Main method, create an instance of the class Server. Set the size of the arrServices array in
your Server instance to contain 2 elements. Create first a WebServer instance and then a DatabaseEngine
instance into this array. Call the Shutdown method from your Server instance.
I could have done only a lil part. Can you guys help me with the rest? please?
 
We can help, but help doesn't mean do it for you. Where is the first place that you're stuck and what is it that you don't understand? Once we get past that roadblock, then you can point out the next issue, and then the next. One of the biggest mistakes beginners make is that they try to tackle entire projects as a whole instead of breaking them down into smaller, manageable chunks.
 
Back
Top