We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

www.vustudents.ning.com

# CS508 Assignment No 02 Solution & Discussion Due Date: 17-01-2018

..How to Join Subject Study Groups & Get Helping Material?..

Views: 3277

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

Attachments:

### Replies to This Discussion

`\$javac Employee.javaEmployee.java:72: error: illegal start of expression pension = ;yh error aa raha hy `

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions. Read More>>

Discussed & be touched with this discussion. After discussion a perfect solution will come in a result at the end.

Note:-

For Important Helping Material related to this subject (Solved MCQs, Short Notes, Solved past Papers, E-Books, FAQ,Short Questions Answers & more). You must view all the featured Discussion in this subject group.

For how you can view all the Featured discussions click on the Back to Subject Name Discussions link below the title of this Discussion & then under featured Discussion corner click on the view all link.

&

.... How to Find Your Subject Study Group & Join ....

P.S:    Please always try to add the discussion in proper format title like “CS101 Assignment / GDB No 01 Solution & Discussion Due Date: ___________”

CHECK AND ENHANCE THIS CODE.

`public class employee {    private int EmployeeId;    private int CNIC;    private String name;    private int Grade;    private float Salary;    private String Category;//Parameterized constructor    public employee(int EmployeeId, int CNIC, String name, int Grade, float Salary, String Category){        this.EmployeeId=EmployeeId;        this.CNIC=CNIC;        this.name=name;        this.Grade=Grade;        this.Salary=Salary;        this.Category=Category;    }    public employee(){        this(0,0,"not set", 0,0,"I");    }    //setters    public void setId (int EmployeeId) {        this.EmployeeId = EmployeeId;    }    public void setName (String name) {        this.name = name;    }    public void setCNIC (int CNIC) {        this.CNIC = CNIC;    }    public void setGrade (int Grade) {        this.Grade = Grade;    }    public void setSalary (int Salary) {        this.Salary = Salary;    }    }`

its Last day today

mila solution kia koi help nai karta idr

doc file

public class employee {
private int EmployeeId;
private int CNIC;
private String name;
private float Salary;
private String Category;
//Parameterized constructor
public employee(int EmployeeId,string CNIC, String name, int Grade, float Salary, String Category){
this.EmployeeId=EmployeeId;
this.CNIC=CNIC;
this.name=name;
this.Salary=Salary;
this.Category=Category;
}

public employee(){
this(1,"0000-00000000-0","Waleed",16,20000,"I");
}
//setters
public void setId (int EmployeeId) {
this.EmployeeId = EmployeeId;
}
public void setName (String name) {
this.name = name;
}
public void setCNIC (string CNIC) {
this.CNIC = CNIC;
}
}
public void setSalary (int Salary) {
this.Salary = Salary;
}
//Getters
public int getid (){
return Employeeid;
}
public string getName (){
return name;
}
public string getCNIC (){
return CNIC;
}
}
public float getSalary (){
return Salary;
}
public string getCategory (){
return Category;
}
void display(){
System.out.println("Employee ID: "+ Employeeid + "\n name:"+name);
System.out.println("Employee CNIC: "+ CNIC);
System.out.println("Salary: "+ salary);
System.out.println("Category: "+ category);
}
}
//Contract Employee Class code
public class CEmployee extends employee{
private int bonus;
private int rollNo;
private int sum;
public CEmployee (){
}
//parameterized constructor
public CEmployee(int i, String cn, String n,int g, float s,String c,int b,int[]rol,int sm){
super(i,cn,n,g,s,c);
bonus = b;
rollNo = rol;
sum = sm;
}
//setter
public void setBonus (int bonus){
this.rollNo[]={0,0,0,0,0,0,0}
this.sum=sum+rollNo[0]+
rollNo[1]+
rollNo[2]+
rollNo[3]+
rollNo[4]+
rollNo[5]+
rollNo[6]+
rollNo[7];

this.bonus=sum*1000/2;
}
//getter
public int getSum(){
return sum;
}
public int getrol(){
return rollNo[0];
}
public void display(){
super.display();

system.out.printIn("CEmployee Bonus:" + sum*1000/2);
}

}

//Permanent Employee Class Code

public class PEmployee extends employee{
private int Gratuity;
private int Pension;
public PEmployee (){
}
public PEmployee(int i, String cn,String n,int g,float s,String c,int gr,int p){
super(i,cn,n,g,s,c);
Gratuity = gr
Pension = p;
}
public void setGratuity (int Gratuity){
this.Gratuity=9;}

public void setPension (int Pension){
this.pension=Gratuidy*3000;}

public int getPension(){
return Pension;
}
public int getGratuity(){return Gratuity;}
public void display(){
super.display();/
system.out.printIn("PEmployee Pension:"+Pesion);
system.out.printIn("PEmployee Gratuity:"+Gratuity);
}

}

//Main test class code

class mtest{
public static void main (String args[]){
System.out.printIn("making object of employee");
System.out.printIn("making object of contracted employee");
CEmpolyee cc = new CEmployee();
PEmpolyee pp = new PEmployee();
cc.display();
System.out.PrintIn("\n\n");
pp.display();
}
}

`\$javac employee.javaemployee.java:80: error: illegal start of expression     this.rollNo[]={0,0,0,0,0,0,0}                 ^ employee.java:80: error: illegal start of expression     this.rollNo[]={0,0,0,0,0,0,0}                   ^ employee.java:80: error: not a statement     this.rollNo[]={0,0,0,0,0,0,0}                    ^ employee.java:80: error: ';' expected     this.rollNo[]={0,0,0,0,0,0,0}                     ^ employee.java:81: error: illegal start of type     this.sum=sum+rollNo[0]+     ^ employee.java:81: error: ';' expected     this.sum=sum+rollNo[0]+         ^ employee.java:81: error: <identifier> expected     this.sum=sum+rollNo[0]+             ^ employee.java:90: error: illegal start of type this.bonus=sum*1000/2; ^ employee.java:90: error: ';' expected this.bonus=sum*1000/2;     ^ employee.java:90: error: <identifier> expected this.bonus=sum*1000/2;           ^ employee.java:93: error: class, interface, or enum expected public int getSum(){        ^ employee.java:95: error: class, interface, or enum expected } ^ employee.java:96: error: class, interface, or enum expected public int getrol(){        ^ employee.java:98: error: class, interface, or enum expected } ^ employee.java:99: error: class, interface, or enum expected public void display(){        ^ employee.java:102: error: class, interface, or enum expected system.out.printIn("CEmployee Bonus:" + sum*1000/2); ^ employee.java:103: error: class, interface, or enum expected  }  ^ employee.java:116: error: ';' expected     Gratuity = gr                  ^ employee.java:130: error: illegal start of expression     super.display();/                     ^ 19 errors `

Error in execution. Kindly help me

check this video solution

https://youtu.be/3Xwq9BJ-Kmg

so it may able to compile ..

Results images are also demanded as well in assignment

## Latest Activity

Maddie, Hira, Saria Ali and 1 more joined Virtual University of Pakistan
8 minutes ago
Fajar liked ++"STrAnGeR"++'s discussion Happy Birthday
33 minutes ago
+!"❀mσσn❀ "ꌗ" left a comment for Student
37 minutes ago
38 minutes ago
Student left a comment for +!"❀mσσn❀ "ꌗ"
39 minutes ago
Fajar replied to ++"STrAnGeR"++'s discussion Happy Birthday
41 minutes ago
+ ! ! ! ! ! ∂ixie ∂us† added a discussion to the group MCM511 Theories of Communication

### Mcm511 Theories of Communication (questions /answers)

47 minutes ago
Zari added a discussion to the group CS402 Theory of Automata

1 hour ago

1

2

3