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


Looking For Something at vustudents.ning.com? Click Here to Search

Lectures Covered : 27-30


Objective
:
The objective of this assignment is to enhance knowledge of Java Programming:
1. It will increase learning of Java data types, classes concepts
2. Hand on experience of arrays
3. Students will be able to implement Inheritance and Over riding


Instructions:
Please read the following instructions carefully before solving & submitting the assignment:
1. The assignment will not be accepted after due date.
2. Zero marks will be awarded to the assignment that does not open or the file is
corrupt.
3. The assignment file must be MS Word (.doc) file format; Assignment will not be
accepted in any other format.
4. Zero marks will be awarded to the assignment if copied (from other student or copied
from handouts or internet).
5. Zero marks will be awarded to the assignment if the Student ID is not mentioned in
the assignment file.
Note: All types of plagiarism are strictly prohibited. Copy cases will be awarded
zero marks.

Question No 1:
Suppose a textile company “Grace Textile” human resource (HR) department. It has total 80
employees in 3 different branches. Employees are of 3 categories: Internees, Contract and Permanent
employees. Internees have internship of 6 months with fixed salary i.e, 20 thousand. Salaries are
calculated on basis of grades. Both contract and permanent employees have different pay scales.
Permanent employees also got benefits of pension and gratuity .Contract employees get monthly
salary and an annual additional bonus.
You are required to write a Java program comprising :
Three Classes Employee, Contract Employee, Permanent Employee
Employee class will have basic attributes of “Employee Id”, CNIC, Name, Grade, Salary and
Category (Internee, Contract, and Permanent). Use “I” for internee, “C” for “Contract” and
“P” for permanent
CNIC will be of format 123-456-789
Contract Employee class will have attributes/data members of Employee class and an
additional member “Bonus”
Permanent Employee class will have attributes of Employee class along with 2 additional
attributes “Gratuity” and “Pension”
Use proper data types for all data members
Write display message of base class and derived classes which will print Emp Id of respective
class
Write a function for Contract Employee Class that will calculate bonus. Roll number will be
stored in an array. Roll number will be your own vu id only digits (8 digits excluding first 2
characters). E.g, If your Roll number is BC12345678, 12345678 will be stored in array. Add
all 8 digits and name it “sum
”. Calculate bonus with formula: (sum*1000)/2; Print value of
bonus.
Steps to Compile /Execute Java Program:

Open following link :
http://www.compileonline.com/compile_java8_online.php
Here you can compile and execute your Java Code with(JDK 1.8.0)*.
1. Paste/replace your code
2.
“Execute” program
3. Take screen shot of code plus result
4. Copy it in .doc file
5. Your assignment should be in .doc or .docx format
Hints: You will use inheritance and overriding for display function.

+ Click Here To Join also Our facebook study Group.

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


See Your Saved Posts Timeline

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.java
Employee.java:72: error: illegal start of expression pension = ;
yh error aa raha hy

Please Discuss here about this assignment.Thanks

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.

Or visit this link 

Click Here For Detail.

&

.•°How to Download past papers from study groups°•.

 

Please Click on the below link to see…

.... 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;
}

}



Admin plz arrange any solution,,

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 int Grade;
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.Grade=Grade;
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 setGrade (int Grade) {
this.Grade = Grade;
}
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 int getGrade (){
return Grade;
}
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("Grade: "+ grade);
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.java
employee.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

Armaan can u share this code in written form?

so it may able to compile ..

Results images are also demanded as well in assignment

RSS

Latest Activity

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service