package work9;
import java.text.DecimalFormat;
import java.util.Scanner;
public class Dwork1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
DecimalFormat df = new DecimalFormat("#.00");
Scanner sc = new Scanner(System.in);
System.out.println("请输入斤数和钱");
double shuliang = sc.nextDouble();
double money = sc.nextDouble();
double qian = count(shuliang);
double cha = money-qian;
System.out.println("应付"+df.format(qian)+"元,应找钱"+df.format(cha)+"元");
}
public static double count(double shuliang) {
double sum;
if(shuliang<=5) {
sum=shuliang*1.05;
return sum;
}else if(shuliang<=10){
sum=shuliang*1;
return sum;
}else if(shuliang<=15) {
sum=shuliang*0.95;
return sum;
}else if(shuliang<=20) {
sum=shuliang*0.90;
return sum;
}else {
sum=shuliang*0.85;
return sum;
}
}
}
package work9;
import java.util.Scanner;
public class Dwork2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i=1;i>0;i++) {
if(i%5==2&&i%7==3&&i%3==1) {
System.out.println("该班级学生总数为:"+i);
break;
}
}
}
}
public class Dwork3 {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("请输入您要转换的数字:");
int x,y,z,t;
for(x = 1; x < 10; x ++)
for(y = 1; y < 10; y ++)
for(z = 0; z < 10; z ++)//
{
t = x * 100 + y * 10 + z + y *100 + z * 10 + z;
if(t == 532)
{
System.out.println("x为"+x+" y为"+y+" z为"+z);
}
}
}
}