09 May 2008 @ 2:16 PM 

A small application I wrote for someone to calculate a salary.

JAVA:
  1. import java.util.InputMismatchException;
  2. import java.util.Scanner;
  3. public class Employee {
  4. static double hourlyRate = 0.0;
  5. static double hoursWorked = 0.0;
  6. public static void main(String[] args){
  7. Scanner sc = new Scanner(System.in);
  8. try{
  9. System.out.print("Employee name: ");
  10. String name  = sc.nextLine();
  11. System.out.print("Hourly rate $");
  12. hourlyRate = sc.nextDouble();
  13. System.out.print("Hour(s) worked: " );
  14. hoursWorked = sc.nextDouble();
  15. System.out.println("Employee " + name + " " + "with an hourly rate of $" + hourlyRate + " earned $" + getPay()
  16. + " by working " + hoursWorked + " hours a week.");
  17. }
  18. catch(InputMismatchException IMME){
  19. System.out.println("Input not correct!");
  20. }
  21. }
  22. public static double getPay(){
  23. double pay = hourlyRate * hoursWorked;
  24. return pay;
  25. }
  26. }

More »

Tags Tags: ,
Categories: Java, Languages
Posted By: HappyFace
Last Edit: 06 Aug 2008 @ 08 39 PM

E-mailPermalinkComments (0)

I wrote this for someone a few months ago because he asked me to code it. I know that there are some students that need to do this as part of their assignment/homework so I though of sharing this for those that are struggling with it.

The code is compiled in PDF format below for easy reading.
http://www.engineeringserver.com/Software/2.0 - Employee Main.pdf
http://www.engineeringserver.com/Software/2.1 - Employee Employee.pdf
http://www.engineeringserver.com/Software/2.2 - Employee Manager.pdf
http://www.engineeringserver.com/Software/2.3 - Employee Executive.pdf
http://www.engineeringserver.com/Software/2.4 - Employee HourlyWorker.pdf

Tags Tags: , , , , ,
Categories: Java
Posted By: HappyFace
Last Edit: 21 Aug 2008 @ 07 37 PM

E-mailPermalinkComments (0)
\/ More Options ...
Change Theme...
  • Role »
  • Posts »
  • Comments »
Change Theme...
  • VoidVoid (Default)
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LiteLightweight