• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I am a true green horn

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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));
}
}
}
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Otherwise, what's the first error that you are getting? Why do you think that is happening?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic