0% found this document useful (0 votes)
8 views

Logical Programs C#

The document defines two classes that implement an abstract Employee class - a fulltime class and a contract class. Both classes override the salary and name methods. The document also includes a form with buttons to create instances of each class and call the methods.

Uploaded by

Varshini Varsha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Logical Programs C#

The document defines two classes that implement an abstract Employee class - a fulltime class and a contract class. Both classes override the salary and name methods. The document also includes a form with buttons to create instances of each class and call the methods.

Uploaded by

Varshini Varsha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

EJ namespace cllp2ql

I{
El abstract class Employee
{
abstract public string s alary ( int an, int m) ;
abstract public string name( string fn, string ln ) ;
}
}
1amespace cll p2ql

class fu l ltime : Empl oyee


{
public int hp, th, id;
~
public string fname, lname;
override public string salary( int h, int t)
{
hp=h;
th =t;
return "MONTH LY SALARY IS: "+ h*t;
}
override public string name( string fn, string ln )
{
fname = fn;
l name = ln;
return "THE NAME IS " + fname + lname;
}
}
namespace cllp2ql
{
class contract : Employee
{
public int an, m, id;
~
public string fname, lname;
override public string salary( int ai, int mi)
{
an= ai;
m =mi;
return "MONTHLY SALARY IS: 11
+ ai / mi;
}
override public string name( string fn, string ln )
{
fname = fn;
lname = ln;
return "THE NAME IS 11
+ fname + lname;
}
}
}
public Forml() "} r rm1 0 X
{
InitializeComponent () ;
}
X
fulltime
private void buttonl_Click(object sender, EventArgs e )
{ MOtlTHIY SAWIY !Sc l!OOOO
THE NAME IS SuNyia.S.mAd
Employee c = new fulltime ( ) ;
MessageBox .Show(c .salary( S00,160) .ToString() +"\ n"
OK contract
+( c . name ( "Suhayla" , "Samad" ))) ;

private void button2_Click(object sender, EventArgs e )


{
Employee a= new contract() ;
MessageBox .Show( a.salary(700000,12 ) .ToString() + "\ n"
+ ( a.name ( "ayman" , "Samad" ))) ;

}
public Forml( ) •7 Form1
{
InitializeComponent( ) ;
}
fulltime
private void buttonl_Click( object sender, EventArgs e ) X
{
Employee c = new fulltime () ; MONTHLY SAIARV 15: 58333
THE NAME IS aymanSamod
MessageBox . Show( c . salary( 500,160) . ToString()+" \ n"
contract
+( c.name ( "Suhayl a" , "Samad" ))) ; OK

private void button2_Click(object sender, EventArgs e )


{
Employee a= new contract () ;
MessageBox .Show( a. salary(700000,12) .ToString() + "\ n"
+ ( a.name ( "ayman" , "Samad" ))) ;

}
}
I

You might also like