文档介绍:全国计算机二级java上机试题 2010
(1) 要求:
在文件中/****n***/的下一行中有错误要改正.
不得加减行. 加减句.
功能是输入一个字符统计该字符窜中的元音字符的个数
import .*;
public class JModify1{
public static void main(String args[]){
CVowel v=new CVowel();
();
}
}
class InputData{
static private String s="";
/****1****/
public void input(){
BufferedReader br=new BufferedReader(new InputStreamReader());
try{
s=();
}catch(IOException e){}
}
static public String getString(){
input();
return s;
}
}
class CVowel{
private String VowelChar="aeiouAEIOU";
private int count=0;
private String s="";
void printCount(){
("请输入一个字符串:");
s=();
char vowel[]=();
for(int i=0;i<;i++)
/*****2*****/
if((vowel[i])==true)
count++;
("元音字母个数为:"+count);
}
} 来源:考试大-计算机二级考试
(2) 要求1在考生文件夹的paper子文件夹下,新键结果文件2编写一个方法get(),该方法返回个位数为6,并且能被3整除的4位数的个数3调用get方法,并将返回指以字符形式写入新键的结果文件
import .*;
public class JDesign1 {
public static void main(String args[]) throws IOException{
//BufferedWriter out=new BufferedWriter(new FileWriter("......"));
//
//
//......
}
static int get(){
//
//
//
//......
}
}
(3) 要求在----n---处添加语句。不得加减行. 加减句。
调用函数f 输出n的所有质数因子如n=13860 则输出2 2 3 3 5 7 1 1
public class JModify2{
public static void f(int n){
int i