Write a program in java to a class called Employee which
is
having the following instance variables.
name(string type)
age(int type)
designation(string type)
salary(double type)
The class Employee must have a parameterized constructor
having
only name as the argument and initializes the name variable.
Proceed with same class....
write a method called empAge to change the state of age
variable after passing an integer value.
write a method called empDesignation to change the state of
variable designation after passing a string.
write a method called empSalary to change the state of
salary
variable after passing a double type value.
After writing the main method create an instance of the
class
Employee and enter the following details and check your
construction by printing it.
said
21
programmer
800.0

In case you haven't guessed it yet, we are not a homework and are not going to do it for you. Now stop flooding the forum with BS and get to work and maybe you'll actually be able to finishe one or two of them.

i have finshed this programe but i don't know if it correct or not

this is the java pro i make on this question

class employee {
	String name;
	int age;
	String designation;
	double salary;


    public void getname() {
    	System.out.println("Said");


    		}
    	public void getage() {
    	System.out.println("21");

    }
     public void getdesignation() {
    	System.out.println(" programmer");

     }
    public void getsalary() {
    	System.out.println(" 800.0");

    }
    public static void main(String ar[])
    {
    	employee child1=new employee();
    	child1.getname();
    	child1.getage();
    	child1.getdesignation();
    	child1.getsalary();
    }
}

Edited 6 Years Ago by masijade: added code tags

Okay? So what compiler messages do you get? What errors do you get when running it? How does the expected output differ from the actual output?

As a few points:

Where is the parameterised constructor?
Where are all of the "emp" methods?

And, let me guess, you copied this from yet another forum that "gave" it to you as an answer. Well, they were f'ing with you.

Edited 6 Years Ago by masijade: n/a

Also, in response to your PMs. Doing your homework for you is not helping you. You would only be that much more lost tomorrow than you are today when you get an assignment that builds on what you were suppossed to have learned today (which you learn nothing if someone else does it).

And I do "understand your situation". You had homework to do and you put it all off until the last minute (probably partying instead) and now you don't have enough time to do them (and don't know how to in the first place since you've probably been sleeping in class because of being fatigued from all the partying). Well, live with the consequences of your decisions.

no sir i did it with my frind yesterday

That makes it even worse than. There are two of you and that's the best you can come up with? Probably he got it from another forum without telling you, or he was f'ing with you himself.

Edited 6 Years Ago by masijade: n/a

i didn't have any partying but the teacher didn't explane very well and he give us the difficult h/w

And so you waited until the last minute to get it clarified? Which only your instructor can do, BTW.

Edited 6 Years Ago by masijade: n/a

sir i am from oman and we don't have like such parties becase we don't have time to sleep also
and i didn't bring that pro but i did it

how can i ask my teacher
he will never help us becase it's ahomework as an asimint

Then all I can say is, I'm sorry. If that's your best attempt you need to start looking for a different line of work to study for.

how can i ask my teacher
he will never help us becase it's ahomework as an asimint

Which makes it his job to help you when you have questions about it. And, no, he won't do it for you and neither will we. As I said before, that is not helping.

This article has been dead for over six months. Start a new discussion instead.