欢迎来到天天文库
浏览记录
ID:35201438
大小:573.50 KB
页数:7页
时间:2019-03-21
《java实验报告一基础编程》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、1.交流交互实验输入输出2.财务应用程序:计算税款3.计算销售额理学院信计13022015.03.24三、程序清单及结果:(需要标明实现程序对应的实验内容,并给出合理的程序注释及运行结果)(一).1)程序清单及注释importjava.util.*;publicclassStudent{publicstaticvoidmain(Stringargs[]){Scannerin=newScanner(System.in);//构造Scanner对象,并与“标准输入流”System.in关联System.out.println("学生姓名,学号,专业");Stringname=in.
2、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-已婚共同纳税人或证实的鳏寡,2-已婚单
3、独纳税人,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.1;}elseif(8351<=income&&incom
4、e<=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(171551<=income&&income<=372950){tax=8350*0.1
5、+(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<=income&&income<=16700){tax=income*0.1;}elseif(16701<=in
6、come&&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-67900)*0.25+(income-13751)*0.28;}elseif(208851<=income&&income<=
7、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+(income-372950)*0.35;}}if(2=
此文档下载收益归作者所有