Create a Employee Class
Hello, Kindly help me , to create a Employee class as per given requirements. Requirements are given below as:
Create a class called Employee that includes three pieces of information as instance variables:
Employee ID (string type)
first name (string type) (default value ‘John’)
last name (string type) (default value ‘Smith’) and
monthly salary (type double).
No argument constructor that initializes the three instance variables. The employee id should be generated using the following process:
The employee id should be a combination of first initial, last initial and a number starting from 10001 for the first employee and increasing by one for each employee. e.g. if John Smith is the first employee then its id will be JS10001 and if George Brown is the second employee then its id will be GB10002
Provide get and set methods for each instance variable. The set method for monthly salary should ensure that its value remains positive – if an attempt is made to assign a negative value, leave the original value.
thanks
What have you done so far? You will not get ready made code here. Post your best attempt and ask specific questions.
Similar Messages
-
How can I create an IList Employee list based on my Employee class?
I'm trying to create an IList<Employee> list based on my Employee class (below). But this is erroring out. Is my employee class missing anything? How could I make this work?
private void EmployeeList()
IList<Employee> arL = new IList<Employee>(); //<<<<----errors out here
arL.Add(new Employee {Name="Mary",Gender="Female", Age=35});
arL.Add(new Employee { Name = "Bob", Gender = "Male", Age = 40 });
arL.Add(new Employee { Name = "Tom", Gender = "Male", Age = 50 });
var qm = from Employee employee in arL
where employee.Age < 50
select employee;
foreach (var m in arL)
Console.WriteLine(m.ToString());
class Employee
private string name;
private string gender;
private int age;
public string Name
get { return name; }
set { name = value; }
public string Gender
get { return gender; }
set { gender = value; }
public int Age
get {return age;}
set {age = value;}
Rich PIList is an interface, not a class. This means that it can't be instantiated (can't be "newed").
List is a class, so it can be instantiated. It implements the IList interface, which means that it must provide the functionality specified in that interface.
That's what an interface is - a definition of functionality that a class must provide. An interface is often described as a contract that a class must fulfill.
So in the code in your last post, you are saying that arL is an instance of some class that implements the IList interface, and you are then setting it to an instance of the class List. The List class implements the IList interface, so this assignment is
legit. It would also be legit to use any other class that implements IList, such as an array.
Any class that implements IList can have as much extra functionality as whoever wrote it likes, as long as it implements at least the functionality of the interface.
Sometimes you will come across a method in a library over which you have no control and which returns IList rather than list. In such a case you will be forced to do something like...
IList list = SomeMethodOrOther();
So you will have no idea what class list is an instance of, but you will know that it has the functionality of IList. This is about the only circumstance where I would recommend defining a variable as IList rather than List (but it probably won't be long
before there are some replies to this post that disagree). -
Overview of Leave --- CREATE OBJECT: The class was not found., error key:
Dear Gurus,
Iam facing this problem that, when i try to open the Leave Overview from the leave request screen. it gives the dump with message
CREATE OBJECT: The class was not found., error key: RFC_ERROR_SYSTEM_FAILURE
this also creates a dump in the back end.
The same dump is appearing when i try to view the Check Documents for the same employee from PTARQ.
Thanks in advance
RamnathHi ,
please find the following solution .it will definitely work .
If you leave configuration is done.
There was an incorrect data in your system. To do these please follow following process.
delete this request using
PTARQ> Delete documents (RPTARQDBDEl)
Please read the report documentation before
deleting the request but it should be safe as it is
a development system.
Please delete this with the above information or delete all
the records for the approver.
After this,, there will be some incorrect workitem in approver inbox.
You need to clear that also by Tcode - SWWL.
ALSO check the leave request workflow of that employee and if there is any error workflow lying in the workflow delete the leave request (which was created with error) Note down the id initiater ( which had error) and in the Test Environment for Leave request (PTARQ) gave the PERNR and delete the documents ( give the id iniater in the document status ).
To check the error work flow go to SWIA and check for that Workflow (Leave) raised by the PERNR at that duration ( check in IT2001 for the duration) and give it here.
After deleting it check in the portal for the leave request if any error is occuring when trying to apply for leave. -
How to create customer report class
Hi all,
As per my requirement i have to create customer report class.
can u plz give ur suggestions regarding this.
Regards
Rama.Bala this is my question.
Use the IMG to create a customer report class 000000## (where nn = group number) for the logical database PNP. Sorting and matchcodes are permitted and the start and end dates are permitted entries for both the data selection period and the person selection period.
Select the following fields for the first page of the SELECT-OPTIONS:
u2022 Personnel number
u2022 Employment status
u2022 Company code
u2022 Personnel subareas
u2022 Employee group
u2022 Employee subgroup
u2022 Cost center
1-2 Assign the new report class to your report.
Regards
Rama. -
Error during creating a new class diagram
Hi everbody,
I'm using JDeveloper 10.1.3.3.0 with ADF Faces and Toplink. I'm exposing to an error message in JDeveloper while creating a new class diagram. The error message is shown in dialog and saying "The name of the element can not be set to 'package name' as another element has got the same name in the package". I have controlled the name of the new class diagram. The name is unique in the package. Also I'm creating this new file in the package "tr.com.bilisim.class_diagram" and details part of this error message in dialog also says
"BME-02002 : The name of the element can not be set to 'class_diagram' as another element has got the same name in the package"
"BME-02002 : The name of the element can not be set to 'bilisim as another element has got the same name in the package"
"BME-02002 : The name of the element can not be set to 'com' as another element has got the same name in the package"
"BME-02002 : The name of the element can not be set to 'tr' as another element has got the same name in the package"
As I understand from the error message, during creating a new class diagram from 'new file dialog' also tries to create the directories in relevant package (tr.com.bilisim.class_diagram).
How can I solve this problem? Please urgent help!
best regards...
--baris-repost
please urgent
--barisk -
Problem with creating my own class...
Hi all,
Purpose with this program:
I want to create my own class StringThing which take a string parameter and transform the content toUpperCase().
I have created a simple class StringThing which look like this:
class StringThing {
public String upperize (String u) {
u.toUpperCase();
return u;
}And my class where I use the StringThing looks like this:
import java.io.*;
class UseStringThing{
public static void main (String arg[]) throws Exception {
BufferedReader keyboard = new BufferedReader(
new InputStreamReader(System.in));
String s,p;
System.out.prinln("write a sentence!");
s=keyboard.readLine();
StringThing thing = new StringThing();
p=thing.upperize(s);
System.out.println(p);
}Am I not supposed to transform my string parameter in my class by using for instance toUpperCase()? Or is there some fundamental rule or piece of code which I forgot?
Thanks in advance,
/Beginner-T-who-ripps-his-hear-over-this-small-problemStrings cannot be modified. What this line does:
u.toUpperCase();
is to create a new String object. toUpperCase() returns the newly created string and you are ignoring the returned value. What you want to do is:
return u.toUpperCase();
or
u = u.toUpperCase(); -
How to create two employees with same name as supplier record?
Dear all,
We need to create a supplier record for an employee so that we can issue invoice for pretty cash payment. If there are 2 employees with same name, how can we create supplier records for these 2 employees? The system does not allow duplicate supplier name.
Please advise.
Regards,
HYHello,
In R12 it is possible to create 2 employee with same name but different employee number.
And also possible to create these 2 employees as suppliers in Payables.
HTH,
Vik -
Class override, how to create the child class and then the base class
I started to write a program for a smart DMM, the problem is every version of the DMM the company change the communication commend.
My idea is to write a child class for every DMM version and every SubVI of the child will override the base class SubVI.
My problem is, i want first to create one child class and after i will see every thing is work, start to create the base class. that way i will see if am thinking the right way.
My question is
How can i create a child class and then create the base class and configure the SubVi of the child class to be Override of the base class?
I tried to search in the property of the class but i didn't see nothing.
Thanks
Solved!
Go to Solution.This can be done and I've done it on occasion.
You simply create the base class with the dynamic dispatch methods you require (connector panes need to be identical to thos of the child class).
Then set the inheritance of the class to inherit from this base class. If your method is defined as a dynamic dispatch method in the parent, you'll most likely now have some errors (unless your child method was already DD in which case you might just be OK already).
To change the inheritance of a class, right-click the properties of the class in your project and select properties. I believe the ineritance tree is at the lower end of the properties. Click on the "change inheritance" (or something similar) to choose the class from which you now wish to inherit.
Say hello to my little friend.
RFC 2323 FHE-Compliant -
Need to create a driver class for a program i have made...
hey guys im new to these forums and someone told me that i could get help on here if i get in a bind...my problem is that i need help creating a driver class for a program that i have created and i dont know what to do. i need to know how to do this is because my professor told us after i was 2/3 done my project that we need at least 2 class files for our project, so i need at least 2 class files for it to run... my program is as follows:
p.s might be kinda messy, might need to put it into a text editor
Cipher.java
This program encodes and decodes text strings using a cipher that
can be specified by the user.
import java.io.*;
public class Cipher
public static void printID()
// output program ID
System.out.println ("*********************");
System.out.println ("* Cipher *");
System.out.println ("* *");
System.out.println ("* *");
System.out.println ("* *");
System.out.println ("* CS 181-03 *");
System.out.println ("*********************");
public static void printMenu()
// output menu
System.out.println("\n\n****************************" +
"\n* 1. Set cipher code. *" +
"\n* 2. Encode text. *" +
"\n* 3. Decode coded text. *" +
"\n* 4. Exit the program *" +
"\n****************************");
public static String getText(BufferedReader input, String prompt)
throws IOException
// prompt the user and get their response
System.out.print(prompt);
return input.readLine();
public static int getInteger(BufferedReader input, String prompt)
throws IOException
// prompt and get response from user
String text = getText(input, prompt);
// convert it to an integer
return (new Integer(text).intValue());
public static String encode(String original, int offset)
// declare constants
final int ALPHABET_SIZE = 26; // used to wrap around A-Z
String encoded = ""; // base for string to return
char letter; // letter being processed
// convert message to upper case
original = original.toUpperCase();
// process each character of the message
for (int index = 0; index < original.length(); index++)
// get the letter and determine whether or not to
// add the cipher value
letter = original.charAt(index);
if (letter >='A' && letter <= 'Z')
// is A-Z, so add offset
// determine whether result will be out of A-Z range
if ((letter + offset) > 'Z') // need to wrap around to 'A'
letter = (char)(letter - ALPHABET_SIZE + offset);
else
if ((letter + offset) < 'A') // need to wrap around to 'Z'
letter = (char)(letter + ALPHABET_SIZE + offset);
else
letter = (char) (letter + offset);
// build encoded message string
encoded = encoded + letter;
return encoded;
public static String decode(String original, int offset)
// declare constants
final int ALPHABET_SIZE = 26; // used to wrap around A-Z
String decoded = ""; // base for string to return
char letter; // letter being processed
// make original message upper case
original = original.toUpperCase();
// process each letter of message
for (int index = 0; index < original.length(); index++)
// get letter and determine whether to subtract cipher value
letter = original.charAt(index);
if (letter >= 'A' && letter <= 'Z')
// is A-Z, so subtract cipher value
// determine whether result will be out of A-Z range
if ((letter - offset) < 'A') // wrap around to 'Z'
letter = (char)(letter + ALPHABET_SIZE - offset);
else
if ((letter - offset) > 'Z') // wrap around to 'A'
letter = (char)(letter - ALPHABET_SIZE - offset);
else
letter = (char) (letter - offset);
// build decoded message
decoded = decoded + letter;
return decoded;
// main controls flow throughout the program, presenting a
// menu of options the user.
public static void main (String[] args) throws IOException
// declare constants
final String PROMPT_CHOICE = "Enter your choice: ";
final String PROMPT_VALID = "\nYou must enter a number between 1" +
" and 4 to indicate your selection.\n";
final String PROMPT_CIPHER = "\nEnter the offset value for a caesar " +
"cipher: ";
final String PROMPT_ENCODE = "\nEnter the text to encode: ";
final String PROMPT_DECODE = "\nEnter the text to decode: ";
final String SET_STR = "1"; // selection of 1 at main menu
final String ENCODE_STR = "2"; // selection of 2 at main menu
final String DECODE_STR = "3"; // selection of 3 at main menu
final String EXIT_STR = "4"; // selection of 4 at main menu
final int SET = 1; // menu choice 1
final int ENCODE = 2; // menu choice 2
final int DECODE =3; // menu choice 4
final int EXIT = 4; // menu choice 3
final int ALPHABET_SIZE = 26; // number of elements in alphabet
// declare variables
boolean finished = false; // whether or not to exit program
String text; // input string read from keyboard
int choice; // menu choice selected
int offset = 0; // caesar cipher offset
// declare and instantiate input objects
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
// Display program identification
printID();
// until the user selects the exit option, display the menu
// and respond to the choice
do
// Display menu of options
printMenu();
// Prompt user for an option and read input
text = getText(input, PROMPT_CHOICE);
// While selection is not valid, prompt for correct info
while (!text.equals(SET_STR) && !text.equals(ENCODE_STR) &&
!text.equals(EXIT_STR) && !text.equals(DECODE_STR))
text = getText(input, PROMPT_VALID + PROMPT_CHOICE);
// convert choice to an integer
choice = new Integer(text).intValue();
// respond to the choice selected
switch(choice)
case SET:
// get the cipher value from the user and constrain to
// -25..0..25
offset = getInteger(input, PROMPT_CIPHER);
offset %= ALPHABET_SIZE;
break;
case ENCODE:
// get message to encode from user, and encode it using
// the current cipher value
text = getText(input, PROMPT_ENCODE);
text = encode(text, offset);
System.out.println("Encoded text is: " + text);
break;
case DECODE:
// get message to decode from user, and decode it using
// the current cipher value
text = getText(input, PROMPT_DECODE);
text = decode(text, offset);
System.out.println("Decoded text is: " + text);
break;
case EXIT:
// set exit flag to true
finished = true ;
break;
} // end of switch on choice
} while (!finished); // end of outer do loop
// Thank user
System.out.println("Thank you for using Cipher for all your" +
" code breaking and code making needs.");
}My source in code format...sorry guys :)
Cipher.java
This program encodes and decodes text strings using a cipher that
can be specified by the user.
import java.io.*;
public class Cipher
public static void printID()
// output program ID
System.out.println ("*********************");
System.out.println ("* Cipher *");
System.out.println ("* *");
System.out.println ("* *");
System.out.println ("* *");
System.out.println ("* CS 181-03 *");
System.out.println ("*********************");
public static void printMenu()
// output menu
System.out.println("\n\n****************************" +
"\n* 1. Set cipher code. *" +
"\n* 2. Encode text. *" +
"\n* 3. Decode coded text. *" +
"\n* 4. Exit the program *" +
"\n****************************");
public static String getText(BufferedReader input, String prompt)
throws IOException
// prompt the user and get their response
System.out.print(prompt);
return input.readLine();
public static int getInteger(BufferedReader input, String prompt)
throws IOException
// prompt and get response from user
String text = getText(input, prompt);
// convert it to an integer
return (new Integer(text).intValue());
public static String encode(String original, int offset)
// declare constants
final int ALPHABET_SIZE = 26; // used to wrap around A-Z
String encoded = ""; // base for string to return
char letter; // letter being processed
// convert message to upper case
original = original.toUpperCase();
// process each character of the message
for (int index = 0; index < original.length(); index++)
// get the letter and determine whether or not to
// add the cipher value
letter = original.charAt(index);
if (letter >='A' && letter <= 'Z')
// is A-Z, so add offset
// determine whether result will be out of A-Z range
if ((letter + offset) > 'Z') // need to wrap around to 'A'
letter = (char)(letter - ALPHABET_SIZE + offset);
else
if ((letter + offset) < 'A') // need to wrap around to 'Z'
letter = (char)(letter + ALPHABET_SIZE + offset);
else
letter = (char) (letter + offset);
// build encoded message string
encoded = encoded + letter;
return encoded;
public static String decode(String original, int offset)
// declare constants
final int ALPHABET_SIZE = 26; // used to wrap around A-Z
String decoded = ""; // base for string to return
char letter; // letter being processed
// make original message upper case
original = original.toUpperCase();
// process each letter of message
for (int index = 0; index < original.length(); index++)
// get letter and determine whether to subtract cipher value
letter = original.charAt(index);
if (letter >= 'A' && letter <= 'Z')
// is A-Z, so subtract cipher value
// determine whether result will be out of A-Z range
if ((letter - offset) < 'A') // wrap around to 'Z'
letter = (char)(letter + ALPHABET_SIZE - offset);
else
if ((letter - offset) > 'Z') // wrap around to 'A'
letter = (char)(letter - ALPHABET_SIZE - offset);
else
letter = (char) (letter - offset);
// build decoded message
decoded = decoded + letter;
return decoded;
// main controls flow throughout the program, presenting a
// menu of options the user.
public static void main (String[] args) throws IOException
// declare constants
final String PROMPT_CHOICE = "Enter your choice: ";
final String PROMPT_VALID = "\nYou must enter a number between 1" +
" and 4 to indicate your selection.\n";
final String PROMPT_CIPHER = "\nEnter the offset value for a caesar " +
"cipher: ";
final String PROMPT_ENCODE = "\nEnter the text to encode: ";
final String PROMPT_DECODE = "\nEnter the text to decode: ";
final String SET_STR = "1"; // selection of 1 at main menu
final String ENCODE_STR = "2"; // selection of 2 at main menu
final String DECODE_STR = "3"; // selection of 3 at main menu
final String EXIT_STR = "4"; // selection of 4 at main menu
final int SET = 1; // menu choice 1
final int ENCODE = 2; // menu choice 2
final int DECODE =3; // menu choice 4
final int EXIT = 4; // menu choice 3
final int ALPHABET_SIZE = 26; // number of elements in alphabet
// declare variables
boolean finished = false; // whether or not to exit program
String text; // input string read from keyboard
int choice; // menu choice selected
int offset = 0; // caesar cipher offset
// declare and instantiate input objects
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
// Display program identification
printID();
// until the user selects the exit option, display the menu
// and respond to the choice
do
// Display menu of options
printMenu();
// Prompt user for an option and read input
text = getText(input, PROMPT_CHOICE);
// While selection is not valid, prompt for correct info
while (!text.equals(SET_STR) && !text.equals(ENCODE_STR) &&
!text.equals(EXIT_STR) && !text.equals(DECODE_STR))
text = getText(input, PROMPT_VALID + PROMPT_CHOICE);
// convert choice to an integer
choice = new Integer(text).intValue();
// respond to the choice selected
switch(choice)
case SET:
// get the cipher value from the user and constrain to
// -25..0..25
offset = getInteger(input, PROMPT_CIPHER);
offset %= ALPHABET_SIZE;
break;
case ENCODE:
// get message to encode from user, and encode it using
// the current cipher value
text = getText(input, PROMPT_ENCODE);
text = encode(text, offset);
System.out.println("Encoded text is: " + text);
break;
case DECODE:
// get message to decode from user, and decode it using
// the current cipher value
text = getText(input, PROMPT_DECODE);
text = decode(text, offset);
System.out.println("Decoded text is: " + text);
break;
case EXIT:
// set exit flag to true
finished = true ;
break;
} // end of switch on choice
} while (!finished); // end of outer do loop
// Thank user
System.out.println("Thank you for using Cipher for all your" +
" code breaking and code making needs.");
} -
Problem in Creating a Employee...
Hi all,
I'm new to SAP HR and when im creating a Employee using PA30...itz asks for Peronnel area , emggroup and emp subgroup , i have given PA and EG when im searching for ESG it's popuping an information (No entry in T001P for personnel area INOT), and i cant create the employee.....check
V_T001P assign ur PSA to PA
PA40 is used to run the acitons
PA30 to maintian the master data
rest was udated by dilek
Edited by: Sikindar on Oct 8, 2008 2:16 PM -
Problem in creating a Persistent Class
Hi All,
I am working on Persistent Classes for the first time. I have tried to gain some info by going through some related threads and of course Thomas' Blog on Persistent Classes.
My Problem:
I have been trying to create a Persistent Class that takes fields from multiple database tables (KNA1 and KNVV).
I wasn't able to generate mapping successfully.
So, the solution was to create 2 Persistent Classes and create a data model class for these two (It was mentioned in one of the threads)
I have been trying to create a Persistent Class for the fields from table KNA1 (I need only some 11 fields)
When I activate, I again get a warning 'No mapping exists for the fields' as a result of which the main class is not activated.
I read somewhere that all fields from a table needs to be included in the 'Inclusion area', otherwise, the class doesn't activate.
So I tried creating a view, but I get another warning message saying 'Database operations with view are not allowed' and the main class remains unactivated.
Please suggest.
Also, if there are any related materials on how to deal with multiple tables, I would be more than glad.
Thanks for all your time.If you are creating a persistent class for SAP tables, then effectively you are attempting to update the tables directly. And that is a really bad idea.
See [here|regarding updation of database table...; and [here |Important points to be cautios of when updating a standard table; for more discussion on that topic.
Only create persistent classes for database operations on your own tables.
I guess your classes are failing because you haven't done the mapping. Did you click on the button marked "persistence" on the SE24 view of your ZCL class?
matt
One more thing - it's against the forum rules to ask for material and links... -
Create a new class in pe51 form layout
Hi experts,
I want to create a new form layout in pe51 for payroll register. In standard form class maximum columns is 132 but i want
more than 300 columns for payroll register. so its possible to to create new zform class in pe51. If its possible pls guide me.
Thanks in advance.
Thanks & Regards
G.VendhanHi, I am working on the same thing and created a form in PE51 using Form class CKT0 which gives me 255 columns. I am however having problems with finding some of the fields I need.
Thanks.
N -
Is it possible to create a javafx class without extending Application class ? If yes, how ?
There is no such thing as a javafx class. It is a regular java class. The Aapplication class is the entry
point for JavaFX application. You have to extend the Application class to create Javafx application . -
How to create a Calendar Class in Universe.
I want to create a Calendar class which will further contain Year,Quarter,Month,Day,Week Objects which can be used at report level.
In our database we have different dates in " DD/MM/YYYY:hh:min:ss " format.
I would like to know if this can be used to create a new Calendar Object or do I need a different table in DB like Calendar look up table provided in sample efashion universe?
Help appreciated.Hi,
Sorry for the delay in coming back - I had no access yesterday.
I am not sure what you mean. If you have a lookup table, then you create views/aliases of this table for each of the dates you want to use it for.
So f your transaction record contains original date and paid_date
you would create a
original_date_view as select * from calendar_lookup
paid_date_view as select * from calendar_lookup
these views could then be joined to the orginal_date and paid_date fields in your transaction table.
In the universe you would then expose 2 classes, which contained the same objects.
Original_date
Date,
Day,
Month,
Year
etc
Paid_date
Date,
Day,
Month,
Year
etc
If you are not using the lookup then you would have to code each date object based on the transaction date field
So Day in orignal_date would be to_char(txn.original_date, "dd")
while Day in Paid_date would be to_char(txn.paid_date, "dd")
Hope this helps
Alan -
Creating a new "Class type" in release procedure.
Hi guys,
how can I create a new <b>"Class type"</b> in release procedure?Hi,
But I do not know why anyone would create a new batch type for release strategies, it is totally unnecessary and provides no additional options. The class type indicates which objects can be classified and there is already one for release strategies.
You can create a new class or add characteristics to the existing class used in the release strategy anyway.
Ther is also NO WAY that two classes can be used in the release strategy and this new class type would not change this either???
Steve B
Maybe you are looking for
-
HP Color LaserJet 2600n installation guide lines
Hi I am using HP color laser Jet 2600n- this one is my first printer- I have not much knowledge about this product, but I searched a lot from Google, I am using windows 7 32bit. I got driver and install. And also update windows, but still it's not w
-
I have accidentally delete sonicfire pro
Hi, adobe premiere 10 elements not add sound at video frame, the program ask me Sonicfire pro, I think have acidentally delete Sonicfire pro and now need new download of this software or adobe premiere 10 element and adobe photoshop 10 elements. Than
-
Application Error: vmsnap23.exe
Hello, All. This is my first post on this forum, so please be nice! Over the past month I have an application error that occurs every time I log on. It appears that the application vmsnap23.exe is failing to start, but I cannot find out what it is (*
-
Why does it not show all the pictures when i open myspace
Hello, I have apple mac pro desktop. When i open some profile on www.myspace.com, does my computer not show all pictures on that profile site. Can some one tell me if i need to download some software or plugin to see all pictures on the pages. I use
-
Mac Mail password rejected by POP server with ATT ISP
Just 2 months ago my ATT mail server keeps rejecting my email password that I use on apple mail as well as gmail. Now I can't use my apple mail application but the same email address with same password will work for web mail by gmail. I spent $ and h