解析时到达文件末尾

时间:2014-11-26 01:30:13

标签: java parsing

"在解析"时到达文件末尾错误正在出现。我检查了所有的括号,但它仍然显示我的错误。有人可以让我知道我应该在哪里添加另一个支架或拿出一个。

import javax.swing.JOptionPane;
import java.text.*;

public class WageComputer { 

    final double HOURLY_WAGE=7.25;
    final double OVERTIME= 1.5*HOURLY_WAGE;

    private int numberOfHours;
    private double totalSales;
    double commision;
    double basicWage;
    double commisionWage;

    public WageComputer() {
        numberOfHours=40;
        totalSales=150.00;
    }


    public WageComputer(int hours, double sales){
        numberOfHours = hours;
        totalSales= sales;
    }

    public int getnumberOfHours() {
        return numberOfHours;
    }

    public double gettotalSales(){
        return totalSales;
    }

    public void setnumberOfHours(int hours) {
        numberOfHours = hours;
    }

    public void settotalSales (double sales) {
        totalSales= sales;
    }

    public double basicWage() {
        double basicWage = HOURLY_WAGE * numberOfHours;

        if (numberOfHours >40){
            basicWage = (numberOfHours - 40) * OVERTIME + 40 * HOURLY_WAGE;
        }
        return basicWage;
    }

    public double commisionWage(){  

        if (totalSales <= 0.99){
            commision = 0;
            return commision * totalSales;
        }
        else if (totalSales <= 99.99){
            commision = .05;
            return commision * totalSales;
        }
        else if (totalSales <= 299.99) {
            commision = .10;
            return commision *totalSales;
        }
        else if (totalSales >= 300.00) {
            commision = .15;
            return commision *totalSales;   
        }
    }

1 个答案:

答案 0 :(得分:1)

可能看起来像这样。 我通过我的日食更新它,希望它对你有帮助。

 public class WageComputer { 

     final double HOURLY_WAGE=7.25;
     final double OVERTIME= 1.5*HOURLY_WAGE;


 private int numberOfHours;
 private double totalSales;
        double commision;
        double basicWage;
        double commisionWage;



     public WageComputer() {
     numberOfHours=40;
     totalSales=150.00;
    }


   public WageComputer(int hours, double sales){
      numberOfHours = hours;
      totalSales= sales;
    }

   public int getnumberOfHours() {
      return numberOfHours;
    }

   public double gettotalSales(){
   return totalSales;
   }

   public void setnumberOfHours(int hours) {
      numberOfHours = hours;
   }

   public void settotalSales (double sales) {
      totalSales= sales;
    }

    public double basicWage() {

         double basicWage = HOURLY_WAGE * numberOfHours;

         if (numberOfHours >40){
            basicWage = (numberOfHours - 40) * OVERTIME + 40 * HOURLY_WAGE;
            }
            return basicWage;
            }

     public double commisionWage(){  
        if (totalSales <= 0.99){
            commision = 0;          
            }
            else if (totalSales <= 99.99){
            commision = .05;         
            }
            else if (totalSales <= 299.99) {
            commision = .10;          
             }
            else if (totalSales >= 300.00) {
            commision = .15;           
            }
        return commision *totalSales;   
     }
     }