<% @ Page language = "c #" runat = "server" debug = "true"%>
Public Class Key
{
PRIVATE INT Shape;
Public Key (int news)
{
Shape = newshape;
}
Public int Shape
{
get
{
Return shape;
}
}
}
Public Class Car
{
PRIVATE STRING Color
PRIVATE INT GEAR;
Private int ignity;
PRIVATE BOOL ENGINERUNING;
Private statin = 0;
Public car (int ignitionshape)
{
Color = "Cold Gray Steel";
Ignition = ignitionshape;
COUNT = 1;
}
Public Static Int Count
{
get
{
Return count;
}
}
Public String Color
{
get
{
Return Color;
}
set
{
Color = Value;
}
}
Public int Gear
{
get
{
Return gear;
}
}
Public string isrunning
{
get
{
ENGINERUNING
{
Return "The Engine is Running."
}
Else
{
Return "The Engine is not running."
}
}
}
Public Void ChangeGear (int Direction)
{
IF (Direction <0) Gear - = 1;
IF (Direction> 0) Gear = 1;
IF (Gear> 5) Gear = 5;
IF (Gear <-1) Gear = -1;
}
Public void changer (String Direction)
{
IF (Direction == "Down")
{
Changegear (-1);
}
IF (Direction == "UP")
{
Changegear ( 1);
}
}
Public void Ignition (Key IgnitionKey)
{
IF (IgnitionKey.Shape == Ignition) Enginerunning = True;
}
Public void engineoff ()
{
ENGINERUNNING = FALSE;
}
}
Public void Page_load ()
{
Key AlexKey = New Key (0987654321);
Key Robkey = New Key (1861005040);
Key mykey = new key (1234567890);
Car mycar = new car (1234567890);
Response.write (" New Object 'Mycar' Created. B>");
Response.write ("Color:" mycar.color); Response.write ("Gear:" mycar.gear);
Mycar.color = "black";
Mycar.changegear ( 1);
Response.write (" Properties Updated. B>");
Response.write ("NEW Color:" mycar.color);
Response.write ("NEW GEAR:" MyCar.Gear);
Mycar.changegear ("UP");
Response.write (" shifted 'up' one gear. B>");
Response.write ("NEW GEAR:" MyCar.Gear);
Response.write ("
Mycar.ignition (alexkey);
Response.write (mycar.ismunning);
Response.write ("
Mycar.ignition (robkey);
Response.write (mycar.ismunning);
Response.write ("
Mycar.ignition (mykey);
Response.write (mycar.ismunning);
Response.write ("ATTempting to Stop MyCar:");
Mycar.engineoff ();
Response.write (mycar.ismunning);
}
script>
hEAD>
body>
html>