Results 1 to 7 of 7
Thread: Help me Please??
- 11-17-2012, 02:14 AM #1
Member
- Join Date
- Nov 2012
- Posts
- 57
- Rep Power
- 0
Help me Please??
I am trying to create a compensation report for employees based on an earned commission credit offered by the firm that is determined by annual sales percentages, and I am supposed to call two separate classes, on separate files to accomplish this....
I have managed to work out the compensation formula, and it does display the correct amounts based on the commission curve, but I am having serious issues getting to include the second class, because no matter what I try, I keep getting an error requesting for me to create a class for any variables that I import from the other class.
Here is the code from what I have so far:
and this does what it is supposed to.... It compiles, runs, and returns the desired values to the user, but for the life of me I cannot figure out how to add a second class to this, despite watching numerous tutorials showing how it is done.Java Code:/*Zachariah A Lloyd*/ package newcommissions; import java.util.Scanner; public class NewCommissions { public static double main(String[] args) { Scanner input = new Scanner (System.in); //obtains input double sales; // annual sales total double commission = 0;// rate of commission double pay;// pay including commision bonus System.out.println ("This program computes commission bonuses, based on annual sales."); System.out.print ("Please enter yearly sales total: $"); sales = input.nextDouble(); //user prompt if (sales >= 80000) { // user input commission = 0.05;} //Applies commission bonus } if (sales >= 100000) { commission = 0.0625;} if (sales < 80000) { commission = 0; } pay = ((sales * commission) + 50000); // commission bonus added return commission; }}
For the record, I am experiencing my disappointments in NetBeans 7.2
I have tried the method I have been shown, of going to the source package, newcommissions and right clicking to create a new Java class, but it will not let me do even the simplest operations in this class I create. As below:

and then, if I try to run this it gives me this gem:
.gif)
But I thought the main was in the initial class file, NewCommissions:

and I am trying to use both classes together, but NetBeans is not having it for some reason??
If anyone can help me and tell me what I am doing wrong, I will be eternally grateful!!
- 11-17-2012, 02:20 AM #2
Member
- Join Date
- Nov 2012
- Posts
- 43
- Rep Power
- 0
Re: Help me Please??
I'm pretty new at this stuff but I don't think a class can return something that way. You would have to create a function that returns an int, create an instance of that object where you want to use it, and then call the function to return the value.
-
Re: Help me Please??
Please show your code for the second class.
- 11-17-2012, 08:49 AM #4
Re: Help me Please??
Please go through the Forum Rules -- particularly the third paragraph.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 11-17-2012, 08:34 PM #5
Member
- Join Date
- Nov 2012
- Posts
- 57
- Rep Power
- 0
- 11-18-2012, 02:47 AM #6
Re: Help me Please??
Continued here: Need to create or set main class for project
db
THREAD CLOSEDWhy do they call it rush hour when nothing moves? - Robin Williams
-
Re: Help me Please??
He never replied to my request for the second class. :(


LinkBack URL
About LinkBacks


Bookmarks