SlideShare ist ein Scribd-Unternehmen logo
1 von 6
Employee Class
// Fig. 10.9: Employee.cs
// Abstract base class for company employees.
using System;


   public abstract class Employee
   {
       private string firstName;
       private string lastName;
       private string socialSecurityNumber;

       // constructor
       public Employee(string firstNameValue,
          string lastNameValue, string ssn)
       {
           FirstName = firstNameValue;
           LastName = lastNameValue;
           SocialSecurityNumber = ssn;
       }
       public string SocialSecurityNumber          // property SS Number
       {
           get
           {
               return socialSecurityNumber;
           }
           set { socialSecurityNumber = value; }


           // end get
       }
       // property FirstName
       public string FirstName
       {
           get
           {
               return firstName;
           }

           set
           {
                 firstName = value;
           }
       }

       // property LastName
       public string LastName
       {
           get
           {
               return lastName;
           }

           set
{
               lastName = value;
           }
       }

       // return string representation of Employee
       public override string ToString()
       {
           return FirstName + " " + LastName + "" + SocialSecurityNumber;
       }

       // abstract method that must be implemented for each derived
       // class of Employee to calculate specific earnings
       public abstract decimal Earnings();

   } // end class Employee




   Commission Employee
using System;
public class CommissionEmployee : Employee //Fig 10.4,CommissionEmployee
{

   private decimal grossSales;            // gross weekly sales
   private decimal commissionRate;


   // commission percentage

   public CommissionEmployee(string first, string last, string ssn,
      decimal sales, decimal rate):base(first,last,ssn)
   {


       // implicit calls to all base constructors starts here

       GrossSales = sales;     // validate gross sales via property
       CommissionRate = rate; // validate commission rate via property
   } // end five-parameter CommissionEmployee constructor




   public decimal GrossSales              // property GrossSales
   {
       get
       {
           return grossSales;
} // end get
         set
         {
             grossSales = (value < 0) ? 0 : value;
         } // end set
    } // end property GrossSales
    public decimal CommissionRate    // Property CommisionRate
    {
         get
         {
             return commissionRate;
         } // end get
         set
         {
             commissionRate = (value > 0 && value < 1) ? value : 0;
         } // end set
    } // end property
    //
    public override decimal Earnings()           // Method to calculate
earnings
    {
         return commissionRate * grossSales;
    }

    public override string ToString() // Method ToString
    {
        return string.Format(base.ToString()
        , GrossSales, CommissionRate);
    }



} // end class CommissionEmployee
BasePlusCommission
public class BaseplusCommissionEmployee : CommissionEmployee//Fig
10.4,CommissionEmployee
{

    private decimal basesalary;



    public BaseplusCommissionEmployee(string first, string last, string ssn,
       decimal sales, decimal rate, decimal salary)
        : base(first, last, ssn, sales, rate)
    {

        BaseSalary = salary;




    } // end five-parameter CommissionEmployee constructor




    public decimal BaseSalary
    {
        get { return basesalary; }

        set { basesalary = (value < 0) ? 0 : value; }

    }
    //
    public override decimal Earnings()          // Method to calculate
earnings
    {
         return basesalary + base.Earnings();
    }

    public override string ToString() // Method ToString
    {
        return string.Format("{0}{1}{2}",base.ToString(),
         "base salary", BaseSalary);
    }
} // end class CommissionEmployee
Overtime

using   System;
using   System.Collections.Generic;
using   System.Linq;
using   System.Text;



class HourlyEmployee : Employee
{
    private decimal hourp;

    private decimal hourc;
    public HourlyEmployee(string first, string last, string ssn,   decimal
hourprice, int houercredit)
        : base(first, last, ssn)
    {
        Hour = hourprice;
        Credit = houercredit;



    }

    public decimal Hour
    {
        get { return hourp; }
        set { hourp = (value < 0) ? 0 : value; }


    }
    public decimal Credit
    {
        get { return hourc; }
        set { hourc = (value < 0) ? 0 : value; }
    }

    public override decimal Earnings()
    {
        if (hourc <= 40)

              return hourp * hourc;
         else
           return (40* hourp) + ((hourc - 40) * hourp * 1.5m);


    public override string ToString()
    {
        return String.Format("{0} {1}", base.ToString(), Earnings());
    }

}
Main

using   System;
using   System.Collections.Generic;
using   System.Linq;
using   System.Text;

namespace ConsoleApplication149
{
    class Program
    {
        static void Main(string[] args)
        {
             Employee e1 = new CommissionEmployee("ahmad", "yaseer", "19999",
1.5M, 3.6M);
             Employee e2 = new BaseplusCommissionEmployee("Amer", "yaseen",
"19999", 1.5M, 3.6M, 240.0M);
             HourlyEmployee O5 = new HourlyEmployee("hamzeh", "fadi", "19999",
10.0m, 5);
             Employee e4 = O5;
             e4.Earnings();
             Console.WriteLine(e2.Earnings());


         }


    }
}

Weitere ähnliche Inhalte

Was ist angesagt?

The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.10 book - Part 35 of 212The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.10 book - Part 35 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 40 of 210
The Ring programming language version 1.9 book - Part 40 of 210The Ring programming language version 1.9 book - Part 40 of 210
The Ring programming language version 1.9 book - Part 40 of 210Mahmoud Samir Fayed
 
C++ extension methods
C++ extension methodsC++ extension methods
C++ extension methodsphil_nash
 
The Ring programming language version 1.5.2 book - Part 20 of 181
The Ring programming language version 1.5.2 book - Part 20 of 181The Ring programming language version 1.5.2 book - Part 20 of 181
The Ring programming language version 1.5.2 book - Part 20 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 23 of 185
The Ring programming language version 1.5.4 book - Part 23 of 185The Ring programming language version 1.5.4 book - Part 23 of 185
The Ring programming language version 1.5.4 book - Part 23 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.5.2 book - Part 26 of 181The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.5.2 book - Part 26 of 181Mahmoud Samir Fayed
 
6. Generics. Collections. Streams
6. Generics. Collections. Streams6. Generics. Collections. Streams
6. Generics. Collections. StreamsDEVTYPE
 
The Ring programming language version 1.9 book - Part 27 of 210
The Ring programming language version 1.9 book - Part 27 of 210The Ring programming language version 1.9 book - Part 27 of 210
The Ring programming language version 1.9 book - Part 27 of 210Mahmoud Samir Fayed
 
Javascript ES6 generators
Javascript ES6 generatorsJavascript ES6 generators
Javascript ES6 generatorsRamesh Nair
 
The Ring programming language version 1.8 book - Part 25 of 202
The Ring programming language version 1.8 book - Part 25 of 202The Ring programming language version 1.8 book - Part 25 of 202
The Ring programming language version 1.8 book - Part 25 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 16 of 84
The Ring programming language version 1.2 book - Part 16 of 84The Ring programming language version 1.2 book - Part 16 of 84
The Ring programming language version 1.2 book - Part 16 of 84Mahmoud Samir Fayed
 

Was ist angesagt? (20)

The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.10 book - Part 35 of 212The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.10 book - Part 35 of 212
 
The Ring programming language version 1.9 book - Part 40 of 210
The Ring programming language version 1.9 book - Part 40 of 210The Ring programming language version 1.9 book - Part 40 of 210
The Ring programming language version 1.9 book - Part 40 of 210
 
Ns2programs
Ns2programsNs2programs
Ns2programs
 
Ff
FfFf
Ff
 
C++ extension methods
C++ extension methodsC++ extension methods
C++ extension methods
 
The Ring programming language version 1.5.2 book - Part 20 of 181
The Ring programming language version 1.5.2 book - Part 20 of 181The Ring programming language version 1.5.2 book - Part 20 of 181
The Ring programming language version 1.5.2 book - Part 20 of 181
 
The Ring programming language version 1.5.4 book - Part 23 of 185
The Ring programming language version 1.5.4 book - Part 23 of 185The Ring programming language version 1.5.4 book - Part 23 of 185
The Ring programming language version 1.5.4 book - Part 23 of 185
 
Csharp_Chap13
Csharp_Chap13Csharp_Chap13
Csharp_Chap13
 
The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.5.2 book - Part 26 of 181The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.5.2 book - Part 26 of 181
 
C++ TUTORIAL 5
C++ TUTORIAL 5C++ TUTORIAL 5
C++ TUTORIAL 5
 
Awt
AwtAwt
Awt
 
C++ TUTORIAL 3
C++ TUTORIAL 3C++ TUTORIAL 3
C++ TUTORIAL 3
 
6. Generics. Collections. Streams
6. Generics. Collections. Streams6. Generics. Collections. Streams
6. Generics. Collections. Streams
 
C++ TUTORIAL 8
C++ TUTORIAL 8C++ TUTORIAL 8
C++ TUTORIAL 8
 
C++ TUTORIAL 7
C++ TUTORIAL 7C++ TUTORIAL 7
C++ TUTORIAL 7
 
The Ring programming language version 1.9 book - Part 27 of 210
The Ring programming language version 1.9 book - Part 27 of 210The Ring programming language version 1.9 book - Part 27 of 210
The Ring programming language version 1.9 book - Part 27 of 210
 
Javascript ES6 generators
Javascript ES6 generatorsJavascript ES6 generators
Javascript ES6 generators
 
The Ring programming language version 1.8 book - Part 25 of 202
The Ring programming language version 1.8 book - Part 25 of 202The Ring programming language version 1.8 book - Part 25 of 202
The Ring programming language version 1.8 book - Part 25 of 202
 
The Ring programming language version 1.2 book - Part 16 of 84
The Ring programming language version 1.2 book - Part 16 of 84The Ring programming language version 1.2 book - Part 16 of 84
The Ring programming language version 1.2 book - Part 16 of 84
 
C++ TUTORIAL 6
C++ TUTORIAL 6C++ TUTORIAL 6
C++ TUTORIAL 6
 

Andere mochten auch

Andere mochten auch (15)

Artikel
ArtikelArtikel
Artikel
 
SIESTA
SIESTASIESTA
SIESTA
 
Presentación1 info
Presentación1 infoPresentación1 info
Presentación1 info
 
ITIL V3
ITIL V3ITIL V3
ITIL V3
 
éDouard manet
éDouard manetéDouard manet
éDouard manet
 
2015 profile - ASH Communications
2015 profile - ASH Communications2015 profile - ASH Communications
2015 profile - ASH Communications
 
Para nubelcilla
Para nubelcillaPara nubelcilla
Para nubelcilla
 
Quality assurance review check list
Quality assurance review check listQuality assurance review check list
Quality assurance review check list
 
หนังสือแจ้งให้เข้ารับการอบรม จ.ขอนแก่น
หนังสือแจ้งให้เข้ารับการอบรม จ.ขอนแก่นหนังสือแจ้งให้เข้ารับการอบรม จ.ขอนแก่น
หนังสือแจ้งให้เข้ารับการอบรม จ.ขอนแก่น
 
Relnotef p11-w-128266
Relnotef p11-w-128266Relnotef p11-w-128266
Relnotef p11-w-128266
 
기아_김동영
기아_김동영기아_김동영
기아_김동영
 
Дамжуулах хоолойн тээвэр
Дамжуулах хоолойн тээвэрДамжуулах хоолойн тээвэр
Дамжуулах хоолойн тээвэр
 
хичээл
хичээлхичээл
хичээл
 
нунтаглалт
нунтаглалтнунтаглалт
нунтаглалт
 
Aws certificate managerを使ってみたよ
Aws certificate managerを使ってみたよAws certificate managerを使ってみたよ
Aws certificate managerを使ってみたよ
 

Ähnlich wie slides

package employeeType.employee;public class Employee {    private.pdf
package employeeType.employee;public class Employee {    private.pdfpackage employeeType.employee;public class Employee {    private.pdf
package employeeType.employee;public class Employee {    private.pdfsharnapiyush773
 
package employeeType.employee;public class Employee {   private .pdf
package employeeType.employee;public class Employee {   private .pdfpackage employeeType.employee;public class Employee {   private .pdf
package employeeType.employee;public class Employee {   private .pdfanwarsadath111
 
package employeeType.employee;public abstract class Employee {  .pdf
package employeeType.employee;public abstract class Employee {  .pdfpackage employeeType.employee;public abstract class Employee {  .pdf
package employeeType.employee;public abstract class Employee {  .pdfnipuns1983
 
Program.cs class Program { static void Main(string[] args).pdf
Program.cs class Program { static void Main(string[] args).pdfProgram.cs class Program { static void Main(string[] args).pdf
Program.cs class Program { static void Main(string[] args).pdfanandshingavi23
 
Code Include libraries. import javax.swing.JOptionPane;.pdf
Code Include libraries. import javax.swing.JOptionPane;.pdfCode Include libraries. import javax.swing.JOptionPane;.pdf
Code Include libraries. import javax.swing.JOptionPane;.pdfankitmobileshop235
 
2. Create a Java class called EmployeeMain within the same project Pr.docx
 2. Create a Java class called EmployeeMain within the same project Pr.docx 2. Create a Java class called EmployeeMain within the same project Pr.docx
2. Create a Java class called EmployeeMain within the same project Pr.docxajoy21
 
How to Start Test-Driven Development in Legacy Code
How to Start Test-Driven Development in Legacy CodeHow to Start Test-Driven Development in Legacy Code
How to Start Test-Driven Development in Legacy CodeDaniel Wellman
 
Create a C# applicationYou are to create a class object called “Em.pdf
Create a C# applicationYou are to create a class object called “Em.pdfCreate a C# applicationYou are to create a class object called “Em.pdf
Create a C# applicationYou are to create a class object called “Em.pdffeelingspaldi
 
Integration Project Inspection 3
Integration Project Inspection 3Integration Project Inspection 3
Integration Project Inspection 3Dillon Lee
 
Production.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdfProduction.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdfsooryasalini
 
Use the code below from the previous assignment that we need to exte.pdf
Use the code below from the previous assignment that we need to exte.pdfUse the code below from the previous assignment that we need to exte.pdf
Use the code below from the previous assignment that we need to exte.pdfsales87
 
import java.io.-WPS Office.docx
import java.io.-WPS Office.docximport java.io.-WPS Office.docx
import java.io.-WPS Office.docxKatecate1
 
maJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docx
maJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docxmaJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docx
maJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docxinfantsuk
 
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfCreat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfaromanets
 
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDBTDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDBtdc-globalcode
 
So here is the code from the previous assignment that we need to ext.pdf
So here is the code from the previous assignment that we need to ext.pdfSo here is the code from the previous assignment that we need to ext.pdf
So here is the code from the previous assignment that we need to ext.pdfleolight2
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6Dmitry Soshnikov
 

Ähnlich wie slides (20)

package employeeType.employee;public class Employee {    private.pdf
package employeeType.employee;public class Employee {    private.pdfpackage employeeType.employee;public class Employee {    private.pdf
package employeeType.employee;public class Employee {    private.pdf
 
package employeeType.employee;public class Employee {   private .pdf
package employeeType.employee;public class Employee {   private .pdfpackage employeeType.employee;public class Employee {   private .pdf
package employeeType.employee;public class Employee {   private .pdf
 
package employeeType.employee;public abstract class Employee {  .pdf
package employeeType.employee;public abstract class Employee {  .pdfpackage employeeType.employee;public abstract class Employee {  .pdf
package employeeType.employee;public abstract class Employee {  .pdf
 
Program.cs class Program { static void Main(string[] args).pdf
Program.cs class Program { static void Main(string[] args).pdfProgram.cs class Program { static void Main(string[] args).pdf
Program.cs class Program { static void Main(string[] args).pdf
 
Code Include libraries. import javax.swing.JOptionPane;.pdf
Code Include libraries. import javax.swing.JOptionPane;.pdfCode Include libraries. import javax.swing.JOptionPane;.pdf
Code Include libraries. import javax.swing.JOptionPane;.pdf
 
2. Create a Java class called EmployeeMain within the same project Pr.docx
 2. Create a Java class called EmployeeMain within the same project Pr.docx 2. Create a Java class called EmployeeMain within the same project Pr.docx
2. Create a Java class called EmployeeMain within the same project Pr.docx
 
How to Start Test-Driven Development in Legacy Code
How to Start Test-Driven Development in Legacy CodeHow to Start Test-Driven Development in Legacy Code
How to Start Test-Driven Development in Legacy Code
 
Create a C# applicationYou are to create a class object called “Em.pdf
Create a C# applicationYou are to create a class object called “Em.pdfCreate a C# applicationYou are to create a class object called “Em.pdf
Create a C# applicationYou are to create a class object called “Em.pdf
 
Integration Project Inspection 3
Integration Project Inspection 3Integration Project Inspection 3
Integration Project Inspection 3
 
Manual tecnic sergi_subirats
Manual tecnic sergi_subiratsManual tecnic sergi_subirats
Manual tecnic sergi_subirats
 
Production.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdfProduction.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdf
 
Use the code below from the previous assignment that we need to exte.pdf
Use the code below from the previous assignment that we need to exte.pdfUse the code below from the previous assignment that we need to exte.pdf
Use the code below from the previous assignment that we need to exte.pdf
 
Unittests für Dummies
Unittests für DummiesUnittests für Dummies
Unittests für Dummies
 
import java.io.-WPS Office.docx
import java.io.-WPS Office.docximport java.io.-WPS Office.docx
import java.io.-WPS Office.docx
 
maJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docx
maJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docxmaJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docx
maJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docx
 
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfCreat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
 
25-functions.ppt
25-functions.ppt25-functions.ppt
25-functions.ppt
 
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDBTDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
 
So here is the code from the previous assignment that we need to ext.pdf
So here is the code from the previous assignment that we need to ext.pdfSo here is the code from the previous assignment that we need to ext.pdf
So here is the code from the previous assignment that we need to ext.pdf
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 

Kürzlich hochgeladen (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

slides

  • 1. Employee Class // Fig. 10.9: Employee.cs // Abstract base class for company employees. using System; public abstract class Employee { private string firstName; private string lastName; private string socialSecurityNumber; // constructor public Employee(string firstNameValue, string lastNameValue, string ssn) { FirstName = firstNameValue; LastName = lastNameValue; SocialSecurityNumber = ssn; } public string SocialSecurityNumber // property SS Number { get { return socialSecurityNumber; } set { socialSecurityNumber = value; } // end get } // property FirstName public string FirstName { get { return firstName; } set { firstName = value; } } // property LastName public string LastName { get { return lastName; } set
  • 2. { lastName = value; } } // return string representation of Employee public override string ToString() { return FirstName + " " + LastName + "" + SocialSecurityNumber; } // abstract method that must be implemented for each derived // class of Employee to calculate specific earnings public abstract decimal Earnings(); } // end class Employee Commission Employee using System; public class CommissionEmployee : Employee //Fig 10.4,CommissionEmployee { private decimal grossSales; // gross weekly sales private decimal commissionRate; // commission percentage public CommissionEmployee(string first, string last, string ssn, decimal sales, decimal rate):base(first,last,ssn) { // implicit calls to all base constructors starts here GrossSales = sales; // validate gross sales via property CommissionRate = rate; // validate commission rate via property } // end five-parameter CommissionEmployee constructor public decimal GrossSales // property GrossSales { get { return grossSales;
  • 3. } // end get set { grossSales = (value < 0) ? 0 : value; } // end set } // end property GrossSales public decimal CommissionRate // Property CommisionRate { get { return commissionRate; } // end get set { commissionRate = (value > 0 && value < 1) ? value : 0; } // end set } // end property // public override decimal Earnings() // Method to calculate earnings { return commissionRate * grossSales; } public override string ToString() // Method ToString { return string.Format(base.ToString() , GrossSales, CommissionRate); } } // end class CommissionEmployee
  • 4. BasePlusCommission public class BaseplusCommissionEmployee : CommissionEmployee//Fig 10.4,CommissionEmployee { private decimal basesalary; public BaseplusCommissionEmployee(string first, string last, string ssn, decimal sales, decimal rate, decimal salary) : base(first, last, ssn, sales, rate) { BaseSalary = salary; } // end five-parameter CommissionEmployee constructor public decimal BaseSalary { get { return basesalary; } set { basesalary = (value < 0) ? 0 : value; } } // public override decimal Earnings() // Method to calculate earnings { return basesalary + base.Earnings(); } public override string ToString() // Method ToString { return string.Format("{0}{1}{2}",base.ToString(), "base salary", BaseSalary); } } // end class CommissionEmployee
  • 5. Overtime using System; using System.Collections.Generic; using System.Linq; using System.Text; class HourlyEmployee : Employee { private decimal hourp; private decimal hourc; public HourlyEmployee(string first, string last, string ssn, decimal hourprice, int houercredit) : base(first, last, ssn) { Hour = hourprice; Credit = houercredit; } public decimal Hour { get { return hourp; } set { hourp = (value < 0) ? 0 : value; } } public decimal Credit { get { return hourc; } set { hourc = (value < 0) ? 0 : value; } } public override decimal Earnings() { if (hourc <= 40) return hourp * hourc; else return (40* hourp) + ((hourc - 40) * hourp * 1.5m); public override string ToString() { return String.Format("{0} {1}", base.ToString(), Earnings()); } }
  • 6. Main using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication149 { class Program { static void Main(string[] args) { Employee e1 = new CommissionEmployee("ahmad", "yaseer", "19999", 1.5M, 3.6M); Employee e2 = new BaseplusCommissionEmployee("Amer", "yaseen", "19999", 1.5M, 3.6M, 240.0M); HourlyEmployee O5 = new HourlyEmployee("hamzeh", "fadi", "19999", 10.0m, 5); Employee e4 = O5; e4.Earnings(); Console.WriteLine(e2.Earnings()); } } }