Re: Help with constructors
Can you copy the command prompt console's contents for when you run the javac and java commands and paste it here?
On windows: To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'
Paste here.
Re: Help with constructors
Quote:
Originally Posted by
Modulus
Modify the Payroll Program so that it uses a class to store and retrieve the employee's name, the hourly rate, and the number of hours worked. Use a constructor to initialize the employee information, and a method within that class to calculate the weekly pay...
I'm thinking that perhaps Employee shouldn't have a setWeeklyPay method or a total field. If it is supposed to have a getWeekleyPay() method, then the weekly pay should be calculated on the spot inside of the method when the method is called. I'm pretty certain that it should have getters and setters for hours and hourlyPay though.
Quote:
My problem is I am not sure if I am doing this correctly. I am writing this in Eclipse and the compiler runs everything in there so it seems the info is being passed between the classes fine, but my problem is when I try to compile in to .class in the command prompt window and run the main class (PayrollInfo) it tells me it cannot find or load the main class PayrollInfo.class
You will need to show us exactly how you're trying to compile the code. You will want to copy the text from your cmd window and post it here so we can see exactly what you're trying to do. Is your code in any packages? Do you use the -cp . command on the command line?