Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes I am a true green horn Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "I am a true green horn" Watch "I am a true green horn" New topic
Author

I am a true green horn

Joe Wekenman
Greenhorn

Joined: Sep 27, 2002
Posts: 1
I just don't get this Java Programming. The teacher I have just lectors and never puts us On the Computers. I have to program a payroll program that figures out over time and hourly rate is over 5.15. Then a second part that tells how many payroll clcs have been figured, total hours and total over time. So parts really through me any hints
Here is what I have so far. I am getting 300 code errors
package payroll;
/**
* Title: Payroll
* Description: Make out payroll check and then figure out stats.
* Copyright: Copyright (c) 2002
* Company:
* @author Joe Wekenman
* @version 1.0
*/
public class App {
public static void main(String[] Args) {
// Variables
int hours;
int dollars;
int over;
int payroll;
int thours;
// Prompt for read
System.out.println("Enter Hours: ");
System.out.println("Enter Pay: ");
hours = Keyboard.readInt();
dollars= Keyboard.readInt();
if (dollars < 5.15)
System.out.println("Enter Hours: ");
System.out.println("Enter Pay: ");
hours = Keyboard.readInt();
dollars= Keyboard.readInt();
if (dollars < 5.15)
else
// Calculate
if (hours > 40) {
hours - 40 = over;
over * .5 = over;
hours + over = thours;
thours * dollars =payroll;
System.out.printin ("Payroll" (payroll));
}
if-else (hours <= 40)
hours * dollars = payroll;
System.out.printin ("Payroll" (payroll));
}
}
}
donepudi madhu
Greenhorn

Joined: Sep 25, 2002
Posts: 11
Hi friend I am also a green horn.I just saw your code.I am very sorry to say this, but U badly need a good teacher or a good book.You made very basic mistakes.The first mistake is you did not use any braces{} to start and end the conditional statement like "if". And there is no statement like if-else its just "if else".
In this line of code," System.out.printin ("Payroll" (payroll)); " there is no printin in JAVA. we should write this line as "System.out.println ("Payroll" + payroll); " We should print the variables using a + operator.
And while assigning a variable, you should not write like this" hours + over = thours;" the expression is to written on the right and the variable on left " thours = hours + over ;".
I dont know about Keyboard.readInt(). I think we can use System.in to get the input.
Please try to read a book and practice on the system.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Advice that has always served me well:
Put the program together one very small part at a time. Do not add a new part until every existing part works.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Otherwise, what's the first error that you are getting? Why do you think that is happening?
 
GeeCON Prague 2014
 
subject: I am a true green horn