Demo3

class person
{

var name: String = Name
var age: Int = Age
var gender: String = Gender
var city: String = City

print(“Name: (name)”)
print(“Age: (age)”)
print(“Gender: (gender)”)
print(“City: (city)”)

}
class Student : person
{
function Person(){
var ID: Double = 201802100410006
var Sem: Int = 6
var Div: String = “A”
var Sub1: Int = 95
var Sub2: Int = 99
var Sub3: Int = 100

print(“ID: (ID)”)
print(“Sem: (Sem)”)
print(“Div: (Sem)”)
print(“Sub1: (Sub1)”)
print(“Sub2: (Sub2)”)
print(“Sub3: (Sub3)”)
print(“Result: (Result)”)

}

  function Result(){
     var result: Float = (Sub1+Sub2+Sub3)/3
  }

}
class Employee : person
{
function Employee(){
var ID: String = “405”
var designation: String = “CEO”
var Salary: Int = 10500
var Gross: Int

print(“ID: (ID)”)
print(“designation: (designation)”)
print(“Salary: (Salary)”)

}

     function Result(){

         if(Salary<10000){

            Gross = Salary + ((10/100)*Salary) + ((5/100)*Salary) +200

           print("Gross Salary: \(Gross)")
        }
         else{
           Gross = Salary + ((15/100)*Salary) + ((7/100)*Salary) + ((10/100)*Salary)

           print("Gross Salary: \(Gross)")
        }
     }

}

var p = person()
p.Person(Name: “Vinod”, Age: 06, Gender: “Male”, City: “Surat”)