第一题
import java.util.Scanner;
public class java {
public class One {
public void main(String[] arge) {
int a = 0;
double b;
double c;
double d;
System.out.println("请输入基本工资:" + a);
Scanner input = new Scanner(System.in);
a = input.nextInt();
System.out.println("该员工的工资细目为");
System.out.println("基本工资:" + a);
b = a * 0.4;
System.out.println("物价津贴:" + b);
c = a * 0.25;
System.out.println("房屋津贴:" + c);
d = a + b + c;
System.out.println("员工基本工资:" + d);
}
}
}
第二题
public class java {
public static void swap(int[] arr) {
int temp = arr[0];
arr[0] = arr[1];
arr[1] = temp;
}
public static void main(String[] arge) {
int[] arr = {10, 8};
System.out.println("输出互换前手中的纸牌:");
System.out.println("左手中的纸牌:"+arr[0]+"\n右手中的纸牌:"+arr[1]);
swap(arr);
System.out.println("输出互换后手中的纸牌:");
System.out.println("左手的纸牌:" + arr[0] + "\n右手的纸牌:" + arr[1]);
}
}
第三题
import java.util.Scanner;
public class java {
public void main(String[] args){
double a=0;
double b;
double c;
double d;
double e;
System.out.println("请输入本金:");
Scanner input=new Scanner(System.in);
System.out.println("本金为:"+a);
b=a+a*0.0225;
System.out.println("存取一年后的本息是:"+b);
c=a+a*0.027*2;
System.out.println("存取二年后的本息是:"+c);
d+a+a*0.0324*3;
System.out.println("存取三年后的本息是:"+d);
e=a+a*0.036*5;
System.out.println("存取五年后的本息是:"+e);
}
}