打卡1
Posted chukjbgg333
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了打卡1相关的知识,希望对你有一定的参考价值。
问题描述:编写一个计算机个人所得税的程序,要求输入收入金额后,能够输出个人所得税,征收如下:
起始点为3500元,征收3%
1500~4500元,征收10%
4500~9000元,征收20%
9000~35000元,征收25%
35000~55000元,征收30%
55000~80000元,征收35%
超出80000元,征收45%
流程图:
伪代码:
start[6]=0,1500,4500,9000,35000,55000
end[6]=1500,4500,9000,35000,55000,80000
taxrate[6]=0.03,0.1,0.2,0.25,0.3,0.35
input profit
tax=0
for i<-0 to 5
if(profit>start[i])
if(profit<=end[i])
tax+=(profit-start[i])*taxrate[i]
else
tax+=(end[i]-start[i])*taxrate[i]
else
break
if(profit>80000)
tax+=(profit-80000)*0.45
output tax
代码:
#include <iostream>
using namespace std;
int main()
int start[6]=0,1500,4500,9000,35000,55000;
int end[6]=1500,4500,9000,35000,55000,80000;
double taxrate[6]=0.03,0.1,0.2,0.25,0.3,0.35;
double profit,tax=0;
int i;
cin>>profit;
for(i=0;i<6;i++)
if(profit>=start[i])
if(profit<end[i])
tax+=(profit-start[i])*taxrate[i];
else
tax+=(end[i]-start[i])*taxrate[i];
else
break;
if(profit>80000)
tax+=(profit-80000)*0.45;
cout<<tax<<endl;
return 0;
SQL 统计每日上班打卡和下班打卡语句
有以上员工打卡记录表
其中
Card_No为考勤卡号
Atte_time 为打卡时间
DoorInout为上班或下班,1为上班,0位下班
想统计没人每天最早上下班打卡,和其他上下班打卡 各去4笔 如不足则为空
如以下样式的表
-----------------------------------------
考勤卡号 日期 上班打卡 上班打卡1 上班打卡2 上班打卡3 下班打卡 下班打卡1 下班打卡2 下班打卡310890895 2013-08-10 16:04 20:24 NULL NULL 19:43 2013-08-11 00:46 NULL NULL10890895 2013-08-11 16:04 19:45 20:18 NULL NULL NULL NULL NULL
如果下班在第二天3点以内的也统计入下班打卡中下班打卡早于最早上班打卡的数据忽略
CREATE TABLE AtteTime
(
Card_No VARCHAR(10) ,
Atte_Time DATETIME ,
DoorInOut BIT
)
select A1.card_no,
A1.atte_time as "上班时间",
A2.atte_time as "上班时间1",
A3.atte_time as "上班时间2",
A4.atte_time as "上班时间3",
B1.atte_time as "下班时间",
B2.atte_time as "下班时间1",
B3.atte_time as "下班时间2",
B4.atte_time as "下班时间3"
from (select card_no, atte_time
from (select card_no,
atte_time,
ROW_NUMBER() over(partition by card_no order by atte_time) as In_ID
from attetime
where doorinout = 1) T
where T.In_ID = 1) A1
left join (select card_no, atte_time
from (select card_no,
atte_time,
ROW_NUMBER() over(partition by card_no order by atte_time) as In_ID
from attetime
where doorinout = 1) T
where T.In_ID = 2) A2
on A1.card_no = A2.card_no
left join (select card_no, atte_time
from (select card_no,
atte_time,
ROW_NUMBER() over(partition by card_no order by atte_time) as In_ID
from attetime
where doorinout = 1) T
where T.In_ID = 3) A3
on A1.card_no = A3.card_no
left join (select card_no, atte_time
from (select card_no,
atte_time,
ROW_NUMBER() over(partition by card_no order by atte_time) as In_ID
from attetime
where doorinout = 1) T
where T.In_ID = 4) A4
on A1.card_no = A4.card_no
full join (select card_no, atte_time
from (select card_no,
atte_time,
ROW_NUMBER() over(partition by card_no order by atte_time desc) as Out_ID
from attetime
where doorinout = 0) T
where T.Out_ID = 1) B1
on A1.card_no = B1.card_no
left join (select card_no, atte_time
from (select card_no,
atte_time,
ROW_NUMBER() over(partition by card_no order by atte_time desc) as Out_ID
from attetime
where doorinout = 0) T
where T.Out_ID = 2) B2
on A1.card_no = B2.card_no
left join (select card_no, atte_time
from (select card_no,
atte_time,
ROW_NUMBER() over(partition by card_no order by atte_time desc) as Out_ID
from attetime
where doorinout = 0) T
where T.Out_ID = 3) B3
on A1.card_no = B3.card_no
left join (select card_no, atte_time
from (select card_no,
atte_time,
ROW_NUMBER() over(partition by card_no order by atte_time desc) as Out_ID
from attetime
where doorinout = 0) T
where T.Out_ID = 4) B4
on A1.card_no = B4.card_no
投入验证数据如下:
执行结果如下:
参考技术A 这是在oracle数据库下做的,不知道你是什么数据库,给你提供一下思路select
card_no,
attr_date,
to_char(atte_time,'HH24:MI')tim,
doorinout,
rn
from (
select
card_no,
attr_date,
atte_time,
doorinout,
ROW_NUMBER() OVER(PARTITION BY card_no,attr_date,doorinout ORDER BY atte_time asc) rn
from(
select
card_no,
(
case
when doorinout=1
then to_date(to_char(atte_time,'yyyy-MM-dd'),'yyyy-MM-dd')
when (doorinout=0 and to_number(to_char(atte_time,'HH24'))<3)
then (to_date(to_char(atte_time,'yyyy-MM-dd'),'yyyy-MM-dd')-1)
else to_date(to_char(atte_time,'yyyy-MM-dd'),'yyyy-MM-dd')
end
)attr_date,
atte_time,
doorinout
from AtteTime
) tmp order by card_no,atte_time asc,doorinout desc
) where rn < 5 参考技术B 能不能来一份数据 这么凭空想 或者构造数据 太麻烦 一些代表性的数据 就行。还有问题要描述清楚 :1)各 取 4笔还是各 去 4 笔,少了为空,多了呢?取时间早的还是时间晚的。
2) 没人每天是什么意思
3) 不经过调试 谁也不能保证自己写出的语句是100%正确的,给点代表性的数据。追问
上班,下班各去4笔数据,少了留空,多了去出去最早前4笔
每人每天的数据意思就是按照考勤号和日期进行分组
数据:字数限制放不上来
给分代表性的数据 错别字还是少点好
追问数据字数太长了放不上来,百度HI上给你吧.
以上是关于打卡1的主要内容,如果未能解决你的问题,请参考以下文章