public class Test {
/**
* 得到大写小写的个数
* @param s
*/
public void calculationCount(String s){
int upCount = 0; //大写
int dwCount = 0;//小写
for(int i = 0;i
dwCount ++;
}else{
upCount ++;
}
}
System.out.println("大写个数:" +upCount + "\r\n小写个数:" + dwCount);
}
/**
* 算出面额的张数
* @param num
*/
public void calculationNum(double num){
String[] s = {"100","50","20","10","5","1","0.5","0.1","0.05","0.02","0.01"};
java.util.Random random = new java.util.Random();
double dqNum = num;
int rows = 0;
int sumCount = 0;
double indxeNum = 0;
for(int i = 0;i
if(i<6){
rows = (int)(dqNum/indxeNum) ;
}else{
rows = (int)(dqNum/indxeNum) ;
}
sumCount += rows;
dqNum = dqNum%indxeNum;
System.out.println(indxeNum + "元有:" + rows + "张");
System.out.println(dqNum);
}
System.out.println("总:" + sumCount + "张");
}
/**
* 素数
* @param num
*/
public void calculationSS(int num){
boolean r = false;
for (int i = 100;i<200;i++){
r = false;
for(int j = 2;j<10;j++){
if(i%j==0){
r = true;
break;
}
continue;
}
if(!r){
System.out.println("素数:"+ i);
}
}
}
/**
* 算高度
* @param num
*/
public void calculationA (double num){
double indexNum = num;
double sumNum = num;
for(int i = 0;i<100;i++){
indexNum = indexNum /2;
sumNum += indexNum;
}
System.out.print("总高度:"+sumNum);
}
/**
*
* @param startNum
* @param stopNum
*/
public void calculationB(int startNum,int stopNum){
while(startNum
String temps = ""+startNum;
if(Integer.parseInt(temps.substring(0,1)) + Integer.parseInt(temps.substring(1,2))+Integer.parseInt(temps.substring(2,3) ) == 10){
System.out.println("总和等于100:"+startNum);
}
}
startNum++;
}
}
public static void main(String args[]){
Test test= new Test();
System.out.println(Math.round(10.567));
test.calculationCount("aBBDDClcfa");
test.calculationNum(900111.09);
test.calculationSS(200);
test.calculationA(100);
test.calculationB(100, 999);
}
}
没有调试,估计有点小问题。。。你看看吧