欢迎来到天天文库
浏览记录
ID:50384588
大小:563.00 KB
页数:7页
时间:2020-03-05
《java实验报告一基础编程.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、1.交流交互实验输入输出2.财务应用程序:计算税款3.计算销售额理学院信计13022015.03.24三、程序清单及结果:(需要标明实现程序对应的实验内容,并给出合理的程序注释及运行结果)(一).1)程序清单及注释importjava.util.*;publicclassStudent{publicstaticvoidmain(Stringargs[]){Scannerin=newScanner(System.in);//构造Scanner对象,并与“标准输入流”System.in关联System.out.println("学生姓名,学号,专业");Stri
2、ngname=in.next();//输入学生姓名intnum=in.nextInt();//输入学号Stringmajor=in.next();//输入专业System.out.println("学生姓名:"+name+"学号:"+num+"专业:"+major);//输出学生姓名,学号,专业}}2)程序运行结果(二).1)程序清单及注释importjava.util.Scanner;publicclassComputeTax{publicstaticvoidmain(String[]args){System.out.println("(0-单身纳税人,1
3、-已婚共同纳税人或证实的鳏寡,2-已婚单独纳税人,3-家庭户主纳税人)");System.out.print("Enterthefilingstatus:");Scannerinput=newScanner(System.in);intchoice=input.nextInt();System.out.print("Enterthetaxableincome:");doubleincome=input.nextDouble();doubletax=0;if(0==choice){if(0<=income&&income<=8350){tax=income*0
4、.1;}elseif(8351<=income&&income<=33950){tax=8350*0.1+(income-8350)*0.15;}elseif(33951<=income&&income<=82250){tax=8350*0.1+(33950-8350)*0.15+(income-33950)*0.25;}elseif(82251<=income&&income<=171550){tax=8350*0.1+(33950-8350)*0.15+(82250-33950)*0.25+(income-82250)*0.28;}elseif(1715
5、51<=income&&income<=372950){tax=8350*0.1+(33950-8350)*0.15+(82250-33950)*0.25+(171550-82250)*0.28+(income-171550)*0.33;}elseif(372951<=income){tax=8350*0.1+(33950-8350)*0.15+(82250-33950)*0.25+(171550-82250)*0.28+(372950-171550)*0.33+(income-372950)*0.35;}}if(1==choice){if(0<=incom
6、e&&income<=16700){tax=income*0.1;}elseif(16701<=income&&income<=67900){tax=16700*0.1+(income-16700)*0.15;}elseif(67901<=income&&income<=137050){tax=16700*0.1+(67900-16700)*0.15+(income-67900)*0.25;}elseif(137051<=income&&income<=208850){tax=16700*0.1+(67900-16700)*0.15+(137050-6790
7、0)*0.25+(income-13751)*0.28;}elseif(208851<=income&&income<=372950){tax=16700*0.1+(67900-16700)*0.15+(137050-67900)*0.25+(208850-13751)*0.28+(income-208850)*0.33;}elseif(372951<=income){tax=16700*0.1+(67900-16700)*0.15+(137050-67900)*0.25+(208850-13750)*0.28+(372950-208850)*0.33+(i
8、ncome-372950)*0.35;}}if(2=
此文档下载收益归作者所有