Created
          November 6, 2013 04:46 
        
      - 
      
- 
        Save pepet96/7331054 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import java.util.Scanner; | |
| import java.io.*; | |
| class BonusWage { | |
| public static void main (String [] args ){ | |
| Scanner input = new Scanner(System.in); | |
| int hours, extrahours; | |
| double wagerate,total,bonus; | |
| System.out.println("Enter your wage rate: "); | |
| wagerate = input.nextDouble(); | |
| System.out.println("Enter the amount of hours you worked: "); | |
| hours = input.nextInt(); | |
| extrahours = hours -30; | |
| if (hours > 30) { | |
| bonus = extrahours*(wagerate*1.5); | |
| total = bonus + ((hours-extrahours)*wagerate); | |
| System.out.println("Your wage will be: " + total); | |
| } | |
| else if (hours >= 0) { | |
| total = wagerate*hours; | |
| System.out.println("Your wage will be: " + total); | |
| } | |
| else if (hours < 0) { | |
| System.out.println("That is not possible!"); | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Recomiendo que en los condicionales explícitamente pongas el rango: Por ejemplo (hours >= 0 && hours <= 30) para delimitarlo mejor y no pase algo raro.