真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

java工資計算代碼 java計算工資的計算例題

java 編程 計算工人工資,

JAVA計算工人工資,參考例子如顫碧下:

成都創(chuàng)新互聯(lián)服務(wù)項目包括中山網(wǎng)站建設(shè)、中山網(wǎng)站制作、中山網(wǎng)頁制作以及中山網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,中山網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到中山省份的部分城市,未來相信會繼續(xù)擴大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!

import java.util.Scanner;

public class Demo00 {

//定義一個三維數(shù)組,用于記錄每個部門、分支、績效工資

private static final float[][][] SALARY_OF_PER_HOUR = {

{{10.75f,12.50f,14.50f},{11.75f,14.50f,17.50f}},

{{13.00f,16.00f,18.50f},{15.00f,18.50f,22.00f}},

{{16.75f,18.50f,20.50f},{19.25f,25.00f,30.00f}}

};

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

//輸入姓名

System.out.println("請輸入姓名:");

String name = sc.nextLine();

//輸入部門并驗證

System.out.println("請輸入部門: A,B,C");

char dept = sc.nextLine().charAt(0);

if(dept'A'||dept'C')

{

System.out.println("輸入有誤,系統(tǒng)將退出");

System.exit(0);

}

//輸入分支機構(gòu)并驗證

System.out.println("請納孝輸入分支機構(gòu): 1,2");

char div = sc.nextLine().charAt(0);

if(div'1'||div'2')

{

System.out.println("輸入有誤,系統(tǒng)將退出");

System.exit(0);

}

//輸入薪績表并驗證

System.out.println("請輸入薪績表: a,b,c");

char sal = sc.nextLine().charAt(0);

if(sal'a'||sal'c')

{

System.out.println("輸入有誤,系統(tǒng)將退出");

System.exit(0);

}

//輸入小時數(shù)

System.out.println("請輸入本周工作時間(整小時數(shù)):");

int hours = sc.nextInt();

float salary = 0;

//每個小時的薪水

float salaryPerHour = SALARY_OF_PER_HOUR[dept-'A'][div-'1'][sal-'a'];

//分別計算40小時內(nèi)和超過40小時的薪水

if(hours=40)

{

salary += salaryPerHour*hours;

}

else

{

salary += salaryPerHour*hours+(hours-40)*1.5*salaryPerHour;

}

//輸出結(jié)果

System.out.println("姓名:\t"+name+"\n部門:\t"+dept+"\n分支機構(gòu):\t"+div

+"\n薪績茄茄舉表:\t"+sal+"\n工作時間:\t"+hours+"\n薪水:\t"+salary);

}

}

//Best wishes!

java計算工資

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("輸入數(shù)據(jù)錯誤!程序提前推出!");

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("輸入?yún)?shù)不正確!程序提前推出!");

}

return hour;

}

}

java算工資的編程題?

class Salary{

private int no;

private String name;

private double deal;

private double tax;

public Salary(int no,String name,double deal,double tax){

this.no=no;

this.name=name;

this.deal=deal;

this.tax=tax;

}

public double count(){

return this.deal-this.tax;

}

public void output(){

System.out.println("工號緩數(shù)腔"+this.no);

System.out.println("姓名"+this.name);

System.out.println("應(yīng)發(fā)工資"+this.deal);

System.out.println("稅畢高金"+this.tax);

System.out.println("實發(fā)工資"+count());

}

public static void main(String[] args){

Salary a=new Salary(1,"張三",1000,200);

a.output();

Salary b=new Salary(2,"擾衫李四",1500,200);

b.output();

}

}


網(wǎng)頁名稱:java工資計算代碼 java計算工資的計算例題
分享URL:http://weahome.cn/article/ddpjjsd.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部