![]() |
A Simple Class
In this Magercise, a simple Employee class is created. Java classes have a syntax very similar to C++, so a C++ programmer should be able to create one easily. The Employee class has two methods and a constructor. The constructor takes a String name as an argument and stores it in a variable. There is also a integer tenure variable, and a simple method to set it. The last method, toString, is provided. More about classes is discussed in the course notes. Work LocationPerform all work for this magercise in VisualAge project MageLang Magercises, package magercises.classes. If this project does not appear in your Workspace add it from the repository (if it exists there) or create a new project using this name. Tasks
Perform the following tasks:
Write a constructor for Employee. Write the setTenure method for Employee. Add a call to setTenure in the main method.
|
Copyright © 1996-1997 MageLang Institute. All Rights Reserved. |