符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
按照题目要绝亮求编写的计算员工昌圆税后工资的Java程序如下
创新互联公司专业为企业提供丰泽网站建设、丰泽做网站、丰泽网站设计、丰泽网站制作等企业网站建设、网页设计与制作、丰泽企业网站模板建站服务,十多年丰泽做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
import java.util.Scanner;
public class Tax{
public static double calculateSalary(double s){
double sat=0;
if(s=5000){
sat=s;
}else if(5000s s=6500){
sat=s-(s-5000)*0.03;
}else if(6500s s=9500){
sat=s-(s-5000)*0.1;
}else if(9500s 耐宏塌 s=14000){
sat=s-(s-5000)*0.2;
}else if(14000s s=40000){
sat=s-(s-5000)*0.25;
}else if(40000s s=60000){
sat=s-(s-5000)*0.3;
}else if(60000s s=85000){
sat=s-(s-5000)*0.35;
}
return sat;
}
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n=0;
double s,sat;
double[] salary=new double[10];
double[] salaryAfterTax=new double[10];
System.out.print("是否添加新员工薪水 y/n?");
String add=sc.next();
while(add.equals("y")){
s=sc.nextDouble();
salary[n]=s;
sat=calculateSalary(s);
salaryAfterTax[n]=sat;
n++;
System.out.print("是否添加新员工薪水 y/n?");
add=sc.next();
}
for(int i=0;in-1;i++){
for(int j=0;jn-1-i;j++){
if(salaryAfterTax[j]salaryAfterTax[j+1]){
double temp=salaryAfterTax[j];
salaryAfterTax[j]=salaryAfterTax[j+1];
salaryAfterTax[j+1]=temp;
}
}
}
System.out.printf("税后工资高的前三名是:%.2f,%.2f,%.2f",salaryAfterTax[0],salaryAfterTax[1],salaryAfterTax[2]);
}
}
person类:
public abstract class Person {
public double pay; // 总工资
public int hour; // 课时
public double countPay(int hour) {
return pay;
}
}
助教类:
public class Assistant extends Person {
public final double BASE_PAY = 800; // 基本工资
public final double HOUR_PAY = 25; // 每课时的费用
public double countPay(int hour) {
pay = BASE_PAY + hour * HOUR_PAY;
return pay;
}
}
讲师类:
public class Instructor extends Person {
public final double BASE_PAY = 1000; // 基本工资
public final double HOUR_PAY = 35; // 每课时的费用
public double countPay(int hour) {
pay = BASE_PAY + hour * HOUR_PAY;
return pay;
}
}
副教授类:
public class AssistantProfesson extends Person {
public final double BASE_PAY = 1200; // 基本工资
public final double HOUR_PAY = 40; //雹宏 每课时的费用
public double countPay(int hour) {
pay = BASE_PAY + hour * HOUR_PAY;
return pay;
}
}
教授类:
public class Professor extends Person {
public final double BASE_PAY = 1400; // 基本工资
public final double HOUR_PAY = 50; /谈肆陪/ 每课时的含蠢费用
public double countPay(int hour) {
pay = BASE_PAY + hour * HOUR_PAY;
return pay;
}
}
测试类:
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Test {
public static void main(String[] args) {
System.out.println("人员类型如下:");
System.out.println("1 = 助教\r\n2 = 讲师\r\n3 = 副教授\r\n4 = 教授");
System.out.print("请选择:");
BufferedReader personType = new BufferedReader(new InputStreamReader(
System.in));
String type = null;
int hour = 0;
try {
type = personType.readLine();
} catch (Exception e) {
e.printStackTrace();
}
if (type.matches("[1-4]{1}")) {
switch (Integer.valueOf(type)) {
case 1:
hour = getHour();
if(hour == 0){return;}
Person p1 = new Assistant();
double pay1 = p1.countPay(hour);
System.out.println("助教工作" + hour + "课时的工资为:" + pay1);
break;
case 2:
hour = getHour();
if(hour == 0){return;}
Person p2 = new Instructor();
double pay2 = p2.countPay(hour);
System.out.println("讲师工作" + hour + "课时的工资为:" + pay2);
break;
case 3:
hour = getHour();
if(hour == 0){return;}
Person p3 = new AssistantProfesson();
double pay3 = p3.countPay(hour);
System.out.println("副教授工作" + hour + "课时的工资为:" + pay3);
break;
case 4:
hour = getHour();
if(hour == 0){return;}
Person p4 = new Professor();
double pay4 = p4.countPay(hour);
System.out.println("教授工作" + hour + "课时的工资为:" + pay4);
break;
}
} else {
System.out.println("输入数据错误!程序提前推出!");
return;
}
}
public static int getHour() {
System.out.print("请输入工作时间:");
BufferedReader hours = new BufferedReader(new InputStreamReader(
System.in));
String strHour = null;
int hour = 0;
try {
strHour = hours.readLine();
} catch (Exception e) {
e.printStackTrace();
}
if (strHour.matches("^[0-9]+?")) {
hour = Integer.parseInt(strHour);
} else {
System.out.println("输入参数不正确!程序提前推出!");
}
return hour;
}
}
一:将员工姓名、工资封装成中模猜一个对象
public class Staff {
private String name;
private int salary;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getSalary() {
return salary;
}
public void setSalary(int salary) {
this.salary = salary;
}
public Staff(String name, int salary) {
super();
this.name = name;
this.salary = salary;
}
}
二:码唤初始化一个数组,算平均工资
public class Average {
public static void main(String[] args) {
Staff staffs[] = {new Staff("zhangsan", 1000), new Staff("lisi", 1100), new Staff("wangwu", 1200)};
int sum = 0;
for(Staff staff : staffs) {
sum = sum + staff.getSalary();
}
System.out.println("员工人数:" + staffs.length + " 总工卖型资:" + sum + " 平均工资:" + sum / staffs.length);
}
}