General discussion

Locked

java program

By iwlu10 ·
Tags: Off Topic
blog root

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

java program

by iwlu10 In reply to java program

I have to follow a Pseudo code, why, I'm not sure, would be easier to write it without it.
but here is the Pseudo code layout:

Payroll
-input : Scanner
+main(args [ ] : String)
-calculateEarnings(employeeCount : int) : String

DEFINE local variable employeeCount, an integer and initialize it to 1
DEFINE local variable employeeCountLimit, an integer and initialize it to 3
DEFINE local variable programOutput, a String
DISPLAY a blank line followed by the task id and programmer (your name) identification line
DISPLAY a blank line followed by the ?Program input line
ASSIGN ?\nProgram output:\n\t#\tGross? TO programOutput
WHILE (employeeCount <= employeeCountLimit)
A-2-07-1) CONCATENATE calculateEarnings(employeeCount) ONTO programOutput
A-2-07-2) INCREMENT employeeCount
DISPLAY programOutput
DISPLAY a blank line followed by the end-of-program line
DEFINE local variable grossPay, a double
DEFINE local variable hoursWorked, an integer
DEFINE local variable hourlyPayRate, an integer
Using the printf method and appropriate horizontal tab(s), DISPLAY ?Enter employee n heading replacing ?n? with the value of employeeCount, a parameter passed to this method from the main method
DISPLAY a blank line
Using appropriate horizontal tab(s), DISPLAY the ?Hours worked? ? prompt
Use ?nextInt()? method of the instance Scanner variable to assign the entered value to the hoursWorked variable
Using appropriate horizontal tab(s), DISPLAY the ?Hourly pay rate? ? prompt
Use ?nextInt()? method of the instance Scanner variable to assign the entered value to the hourlyPayRate variable
DISPLAY a blank line
IF hours worked IS LESS THAN OR EQUAL TO 40 THEN
ASSIGN (hoursWorked * hourlyPayRate) TO grossPay
ELSE
ASSIGN (40.0 * hourlyPayRate) + (hoursWorked ? 40 ) * (hourlyPayRate * 1.5) TO grossPay
END IF
RETURN the following concatenated string: ?\n\t? + employeeCount + ?\t$? + grossPay


here is what I have written, but i get the error as show below my code
import java.util.Scanner;

public class Payroll
{

public static void main (String[] args)
{
int employeeCount = 1;
int employeeCountLimit = 3;
String programOutput = " ";

System.out.println("\nTask 06-02 Ch04 Programmed by Gail");
System.out.println("\nProgram input:");

programOutput += "\n\t#\tGross";

while (employeeCount <= employeeCountLimit)
{
calculateEarnings(employeeCount) += (programOutput);
employeeCount = employeeCount + 1;
}
System.out.println("programOutput");
System.out.println("\n end-of-program line");

Scanner input = new Scanner( System.in );

double grossPay;
int hoursWorked;
int hourlyPayRate;

System.out.println("\tEnter employee %d:,n");

System.out.printf("\n");

System.out.println( "\tHours Worked\t ");
hoursWorked = input.nextInt();

System.out.println( "\tHourly Pay Rate\t ");
hourlyPayRate = input.nextInt();

System.out.printf("\n");

if (hoursWorked <= 40)
{
grossPay = hoursWorked*hourlyPayRate;
}
else
grossPay = (40.0*hourlyPayRate)+(hoursWorked-40)*(hourlyPayRate*1.5);
// end if

System.out.println( "\n\t" + employeeCount + "\t$" + grossPay );

}
}

this is my error
-Called Compiler C:\PROGRA~1\Java\JDK15~1.0_0\bin\javac.exe-
-Target File: G:\Payroll.java-
G:\Payroll.java:19: cannot find symbol
symbol : method calculateEarnings(int)
location: class Payroll
calculateEarnings(employeeCount) += (programOutput);
^
1 error

Back to After Hours Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums