Python编程计算个人所得税(个人所得税计算epython)
C语言计算个人所得税 编程?
程序首先提示用户输入工资,使用 scanf() 函数将用户输入的数据存储到变量 salary 中。然后,使用 if-else 语句
根据税收规定计算税收:如果工资大于5000元,则计算应缴纳的税收((工资-5000)*5%)并减去税收得到税后工资;否则,税收为0,税后工资等于基本工资。最后,程序使用 printf() 函数输出税收和税后工资的值。
、
计算个人所得税
最新的个人所得税的计算方法,
一、2000一下是不用交税的,
二、薪资总额-2000小于500的,税率为5%,计算公式为:超出部分*5%
三、薪资总额-2000大于500小于20000的,税率为10%,速扣税数为25,计算公式为:超出部分*10%-25
四、薪资总额-2000大于2001小于5000的,税率为15%,速扣税数为125,计算公式为:超出部分*15%-125
五、薪资总额-2000大于5001小于20000的,税率为20%,速扣税数为375,计算公式为:超出部分*20%-375
六、薪资总额-2000大于20001小于40000的,税率为25%,速扣税数为1375,计算公式为:超出部分*25%-1375
编程计算个人所得税c++
#includestdio.h
int main(void)
{
int x;
double y;
printf("请输入你的工资薪金总和:");
scanf("%d",x);
if(x=1200)
{
printf("您不需要交纳所得税");
}
else
if(x1200x=1700)
{
y=(x-1200)*0.05;
printf("%lf",y);
}
else
if(x1700x=2000)
{
y=(x-1700)*0.1+25;
printf("%lf",y);
}
else
if(x2000x=5000)
{
y=(x-2000)*0.15+30+25;
printf("%lf",y);
}
else
if(x5000x=20000)
{
y=(x-5000)*0.2+450+30+25;
printf("%lf",y);
}
else
if(x20000x=40000)
{
y=(x-20000)*0.25+3000+450+30+25;
printf("%lf",y);
}
else
if(x40000x=60000)
{
y=(x-40000)*0.3+5000+3000+450+30+25;
printf("%lf",y);
}
else
if(x60000x=80000)
{
y=(x-60000)*0.35+6000+5000+3000+450+30+25;
printf("%lf",y);
}
else
if(x80000x=100000)
{
y=(x-80000)*0.4+7000+6000+5000+3000+450+30+25;
printf("%lf",y);
}
else
{y=(x-10000)*0.45+8000+7000+6000+5000+3000+450+30+25;
printf("%lf",y);
}
return 0;
}
有什么吧明白的在线回答
求一个PYTHON案例
# 以下程序可能要安装OpenCV2.0(并编译好并配置好环境)以及Xvid解码器才能运行
# _*_coding: cp936_*_
import cv
capture = cv.CreateFileCapture("tmp.avi")
#请确保当前目录下有tmp.avi文件
fps = cv.GetCaptureProperty(capture, cv.CV_CAP_PROP_FPS)
totalFrameNumber =cv.GetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_COUNT)
frameWidth = cv.GetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_WIDTH)
frameHeight = cv.GetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_HEIGHT)
print fps, totalFrameNumber, frameWidth, frameHeight
frame = cv.QueryFrame(capture)
while frame:
cv.ShowImage('Title', frame)
frame = cv.QueryFrame(capture)
if cv.WaitKey(1000 / fps) == 27:# ESC键退出视频播放
cv.DestroyWindow('Title')
break
一个文件夹整理工具wxPython版本(不清楚软件用法情况下可以打开该软件看看界面但请不要使用里面的功能,后果自负。)
# -*- coding: cp936 -*-
# file:aa.py
import os, shutil, sys
import wx
sourceDir = ''
sourceFiles = ''
preWord = 0
def browse(event):
global sourceDir, textPreWord, textDirName
dialog = wx.DirDialog(None, u'选择待处理文件夹', style = wx.OPEN)
if dialog.ShowModal() == wx.ID_OK:
sourceDir = dialog.GetPath().strip('\"')
textDirName.SetLabel(sourceDir)
dialog.Destroy()
textPreWord.SetFocus()
def okRun(event):
global preWord, sourceDir, sourceFiles, textPreWord
preWord = int(textPreWord.GetValue())
if preWord = 0:
wx.MessageBox(u'请正确输入前缀字符个数!', u'出错啦', style = wx.ICON_ERROR | wx.OK)
textPreWord.SetFocus()
return
sourceDir = textDirName.GetValue()
sourceFiles = os.listdir(sourceDir)
for currentFile in sourceFiles:
tmp = currentFile
currentFile = sourceDir + '\\' + currentFile
currentFile = currentFile.strip('\"')
if os.path.isdir(currentFile):
continue
targetDir = '%s\\%s'%(sourceDir, tmp[:preWord])
if not os.path.exists(targetDir):
os.mkdir(targetDir)
shutil.move(currentFile, targetDir)
wx.MessageBox(u'任务完成!', u'好消息', style = wx.ICON_ERROR | wx.OK)
def onChange(event):
global dir1, textDirName
p = dir1.GetPath()
textDirName.SetLabel(p)
app = wx.App(0)
win = wx.Frame(None, title = u'文件整理', size = (400, 450))
bg = wx.Panel(win)
btnBrowse = wx.Button(bg, label = u'浏览')
btnBrowse.Bind(wx.EVT_BUTTON, browse)
btnRun = wx.Button(bg, label = u'整理')
btnRun.Bind(wx.EVT_BUTTON, okRun)
dir1 = wx.GenericDirCtrl(bg, -1, dir='', style=wx.DIRCTRL_DIR_ONLY)
tree = dir1.GetTreeCtrl()
dir1.Bind(wx.wx.EVT_TREE_SEL_CHANGED, onChange, id = tree.GetId())
textPreWord = wx.TextCtrl(bg)
textDirName = wx.TextCtrl(bg)
textPreWord.SetFocus()
class MyFileDropTarget(wx.FileDropTarget):#声明释放到的目标
def __init__(self, window):
wx.FileDropTarget.__init__(self)
self.window = window
def OnDropFiles(self, x, y, filenames):#释放文件处理函数数据
for name in filenames:
if not os.path.isdir(name):
wx.MessageBox(u'只能选择文件夹!', '出错啦', style = wx.ICON_ERROR | wx.OK)
return
self.window.SetValue(name)
dt = MyFileDropTarget(textDirName)
textDirName.SetDropTarget(dt)
hbox0 = wx.BoxSizer()
hbox0.Add(dir1, proportion = 1, flag = wx.EXPAND | wx.ALL, border = 5)
hbox1 = wx.BoxSizer()
hbox1.Add(textDirName, proportion = 1, flag = wx.EXPAND, border = 5)
hbox1.Add(btnBrowse, proportion = 0, flag = wx.LEFT, border = 5)
hbox2 = wx.BoxSizer()
hbox2.Add(textPreWord, proportion = 1, flag = wx.EXPAND, border = 5)
hbox2.Add(btnRun, proportion = 0, flag = wx.LEFT, border = 5)
vbox = wx.BoxSizer(wx.VERTICAL)
vbox.Add(hbox0, proportion = 1, flag = wx.EXPAND | wx.ALL, border = 5)
vbox.Add(wx.StaticText(bg, -1, u'\n 选择待处理文件夹路径:'))
vbox.Add(hbox1, proportion = 0, flag = wx.EXPAND | wx.ALL, border = 5)
vbox.Add(wx.StaticText(bg, -1, u'\n\n 前缀字符个数:'))
vbox.Add(hbox2, proportion = 0, flag = wx.EXPAND | wx.ALL, border = 5)
vbox.Add(wx.StaticText(bg, -1, u'\n'))
bg.SetSizer(vbox)
win.Center()
win.Show()
app.MainLoop()
#py2exe打包代码如下:
from distutils.core import setup
import py2exe
setup(windows=["aa.py"])
打包好了之后有18Mb。
一个文件内容批量替换摸查器(wxPython版本):
# _*_ coding:cp936 _*_
from string import join, split
import os
import wx
def getAllFiles(adir):
tmp = []
for parent, dirs, files in os.walk(adir):
for afile in files:
tmp.append(os.path.join(parent, afile))
return tmp
def browse(event):
dialog = wx.DirDialog(None, '选择待处理文件夹', style=wx.OPEN)
if dialog.ShowModal() == wx.ID_OK:
aDir = dialog.GetPath()
textDir.SetLabel(aDir)
dialog.Destroy()
def check():
promp.SetForegroundColour('#FF0000')
promp.SetLabel(' 搜索中...')
listFound.ClearAll()
tmp = []
files = getAllFiles(textDir.GetValue())
for filename in files:
try:
afile = open(filename, 'r')
except IOError:
print '打开文件错误。'
continue
try:
content = afile.read().decode('utf-8')
afile.close()
except:
try:
afile = open(filename, 'r')
content = afile.read().decode('cp936')
afile.close()
except:
continue
if textNeedChar.GetValue() in content:
tmp.append(filename)
listFound.InsertStringItem(0, filename)
parentDir.SetForegroundColour('#FF0000')
# parentDir.SetLabel(' 正在搜索:'+filename)
return tmp
def onFind(event):
check()
parentDir.SetLabel(' 搜索结果:')
promp.SetLabel(' 任务完成。')
wx.MessageBox(listFound.GetItemCount() and '任务完成,找到%d个文件。' % listFound.GetItemCount()
or '未找到包含"%s"的文件!' % textNeedChar.GetValue().encode('cp936'), '查找结束',
style=wx.ICON_INFORMATION | wx.OK)
def onReplace(event):
dg = wx.TextEntryDialog(bg, '替换成:', '提示', style=wx.OK | wx.CANCEL)
if dg.ShowModal() != wx.ID_OK:
return
files = check()
userWord = dg.GetValue()
#if not userWord:
#wx.MessageBox('请输入要替换为何字!', style=wx.ICON_ERROR | wx.OK)
#onReplace(event)
#return
for filename in files:
try:
afile = open(filename, 'r')
except IOError:
print '打开文件错误。'
continue
try:
content = afile.read().decode('utf-8')
afile.close()
except:
try:
afile = open(filename, 'r')
content = afile.read().decode('cp936')
afile.close()
except IOError:
print '打开文件错误。'
continue
content = content.replace(textNeedChar.GetValue(), userWord)
try:
content = content.encode('utf-8')
except:
pass
open(filename, 'w').write(content)
parentDir.SetLabel(' 替换的文件:')
promp.SetLabel(' 任务完成。')
wx.MessageBox(listFound.GetItemCount() and '任务完成,替换了%d个文件。' % listFound.GetItemCount()
or '未找到包含"%s"的文件!' % textNeedChar.GetValue().encode('cp936'), '替换结束', style=wx.ICON_INFORMATION | wx.OK)
app = wx.App(0)
win = wx.Frame(None, title='文件整理', size=(400, 450))
bg = wx.Panel(win)
btnBrowse = wx.Button(bg, label='浏览')
btnBrowse.Bind(wx.EVT_BUTTON, browse)
btnFind = wx.Button(bg, label='查找')
btnFind.Bind(wx.EVT_BUTTON, onFind)
btnFind.SetDefault()
btnReplace = wx.Button(bg, label='替换')
btnReplace.Bind(wx.EVT_BUTTON, onReplace)
textNeedChar = wx.TextCtrl(bg, value='你好')
textDir = wx.TextCtrl(bg, value='E:\Workspace\Python\Python\e')
parentDir = wx.StaticText(bg)
promp = wx.StaticText(bg)
listFound = wx.ListCtrl(bg, style=wx.VERTICAL)
class MyFileDropTarget(wx.FileDropTarget):#声明释放到的目标
def __init__(self, window):
wx.FileDropTarget.__init__(self)
self.window = window
def OnDropFiles(self, x, y, filenames):#释放文件处理函数数据
for name in filenames:
'''if not os.path.isdir(name):
wx.MessageBox('只能选择文件夹!', '出错啦', style=wx.ICON_ERROR | wx.OK)
return '''
self.window.SetValue(name)
dt = MyFileDropTarget(textDir)
textDir.SetDropTarget(dt)
hbox1 = wx.BoxSizer()
hbox1.Add(textDir, proportion=1, flag=wx.EXPAND, border=5)
hbox1.Add(btnBrowse, proportion=0, flag=wx.LEFT, border=5)
hbox2 = wx.BoxSizer()
hbox2.Add(textNeedChar, proportion=1, flag=wx.EXPAND, border=5)
hbox2.Add(btnFind, proportion=0, flag=wx.LEFT, border=5)
hbox2.Add(btnReplace, proportion=0, flag=wx.LEFT, border=5)
vbox = wx.BoxSizer(wx.VERTICAL)
vbox.Add(wx.StaticText(bg, -1, '\n 选择待处理文件夹(可拖动文件夹到下面区域中):'))
vbox.Add(hbox1, proportion=0, flag=wx.EXPAND | wx.ALL, border=5)
vbox.Add(wx.StaticText(bg, -1, '\n\n 要替换 / 查找的文字:'))
vbox.Add(hbox2, proportion=0, flag=wx.EXPAND | wx.ALL, border=5)
vbox.Add(promp, proportion=0, flag=wx.EXPAND | wx.ALL, border=5)
vbox.Add(parentDir, proportion=0, flag=wx.EXPAND | wx.ALL, border=5)
vbox.Add(listFound, proportion=1,
flag=wx.EXPAND | wx.LEFT | wx.BOTTOM | wx.RIGHT, border=5)
bg.SetSizer(vbox)
win.Center()
win.Show()
app.MainLoop()
如何用python算税收
应税所得额=扣除三险一金后月收入-扣除标准,
三险一金缴纳的基准工资上限为7662 ;超过,就按照7662缴纳。
计算个人所得税
有纳税所得额可能小于3500要先判断纳税所得额是否为负数;
正数根据公式:应纳个人所得税税额=全月应纳税所得额x适用税率速算扣除数个税。