1 js 实现类A,B A继承于B,并且A重写B的某一个方法
2 java 实现二分法返回一个升序数组的索引
3 现有一元,五角,二角,一角,五分,二分,一分 几种货币,用java编写一个方法实现一元钱有多少种组合.
4 接收两个file 参数 inputfile,outputfile,将inputfile的内容读出,并转换内容写到outputfile中
inputfile 内容
张三 1 月 300
张三 2 月 400
李四 1月  500
王五 2月  600
王五 3月  300
outputfile内容      1月  2 月  3月 
张三  300  400   500
李四  500  0      0
王五   0   600   300

解决方案 »

  1.   

    希望能得到答案哦第四题是 用java 去写一个方法,实现那样的效果
      

  2.   

    1.做个简单的Demo
    function A(first, last) {
    if ( arguments.length > 0 )
        this.init(first, last);
    }A.prototype.init = function(first, last) {
        this.first = first;
        this.last  = last;
    }
    function B(first, last, id) {
        if ( arguments.length > 0 )
            this.init(first, last, id);
    }B.prototype = new A();
    B.prototype.constructor = B;
    B.superclass = A.prototype;B.prototype.init = function(first, last, id) {    
        // Call superclass method
        B.superclass.init.call(this, first, last);    // init properties
        this.id = id;
    }
      

  3.   

    接着补充:
    第二题没看懂意思.
    第三题,直接代码给你,如下 :
    package com.ce.exam;public class Calculate { /**
     * 1 5 2 0.1 0.05 0.02 0.01
     * @param args
     */
    public static void main(String[] args) {
    System.out.println("有如下几种组合......");
    int count = 0; //记数
    for(int x=0;x<=1;x++){
    for(int y = 0;y<=2;y++){
    for(int a = 0 ; a <=5;a++){
    for(int b =0 ; b <= 10 ; b++){
    for(int c = 0 ; c <= 20 ; c++){
    for(int d = 0 ; d <=50;d++){
    for(int e = 0 ; e <= 100; e++){
    if(x + 0.5*y + 0.2*a + 0.1*b + 0.05*c + 0.02*d + 0.01*e == 1){
    count ++ ;
    System.out.println("1元的" + x + "张  5毛的" + y + "张   2毛的" + a + "张    1毛的" + b 
    +"张   5分的" + c + "张   2分的" + d + "张    1分的" + e + "张");
    }
    }
    }
    }
    }
    }
    }
    }
    System.out.println("总共有" + count +"种组合方法");
    }}
      

  4.   

    第4题..
    package com.ce.exam;import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;public class ReadAndWrite { /**
     * @param args
     */
    public static void main(String[] args) {
    ReadAndWrite rw =new ReadAndWrite();
    try {
    rw.read("文件路径");
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }

    public void read(String filePath) throws IOException{
    File file = new File(filePath);
    String[][] arr = new String[4][4];
    arr[0][0] = "";
    arr[0][1] = "1月";
    arr[0][2] = "2月";
    arr[0][3] = "3月";
    arr[1][0] = "张三";
    arr[2][0] = "李四";
    arr[3][0] = "王五";
    BufferedReader br = new BufferedReader(new FileReader(file));
    while(br != null){
    String temp = br.readLine();
    String[] record = temp.split(" ");
    String  name = record[0];
    String month = record[1];
    String money = record[2];

    //将有数据的月份存放好
    for(int i = 1 ; i <=3 ; i++){
    if(month.equals(arr[0][i])){
    for(int j=1;j<=3;j++){
    if(name.equals(arr[j][0])){
    arr[j][i] = money;
    }
    }
    }
    }
    }
    //处理那些没有的值的月份
    for(int i = 1 ; i <= 3;i++){
    for(int j=1;j<=3;j++){
    if(arr[i][j]==null || arr[i][j]==""){
    arr[i][j] = "0";
    }
    }
    }
    //将arr写出到一个文件中...代码略
    //如果这部分你自己搞不定,那就回家吃饭去吧........


    }}