【实验名称】实验1Java程序设计基础【实验目标】1、学习和掌握Java程序的基本结构。2、学习和掌握Java程序的基本开发过程和方法。3、学习和掌握程序设计的基本开发步骤。4、学习和掌握Java程序的基本输入、输出方法。5、学习和掌握Java程序设计的基本技.【实验日期和时间记录】-、。【实验预习】练习利用Java输出简单语句。【实验过程及结果记录】e{publicstaticvoidmain(String[]args){(“etoJava!”);}}2、(财务应用程序:工资单)编写程序,读入工资基本信息并打印工资单。编写两种版本的程序,依次使用控制台实现输入\输出和GUI实现输入\输出。运行效果可参见图1和图2。【实验预习】练习GUI输入输出,键盘输入,存在一个变量里面,整体输出。【实验过程及结果记录】控制台界面/***@(#)******@author****@*/;//puteAndShowSolary{publicstaticvoidmain(String[]args){ //inputsection ("Enteremployee'sname:");//Promttheusertoenteraname Scannerinput=newScanner(); Stringname=();//inputthename ("Enternumberofhoursworkedinaweek:");//Promttheusertoenternumberofhours doubleworkhour=();//inputthehour ("Enterhourlypayrate:");//Promttheusertoentertherate doublepayrate=();//inputtherate ("EnterfederaltaxWithholdingrate:");//Promttheusertoenterthefederaltaxrate doublefederalrate=();//inputthefederaltaxrate ("EnterstatetaxWithholdingrate:");//promttheusertoenterthestatetaxrate doublestaterate=();//inoutthestatetaxrate //outputsection ("雇员姓名:"+name);//outputemployee'sname ("工作小时数:"+workhour);//outputhoursworked ("每小时工资数:"+"$"+payrate);//outputpayrate ("工资总收入:"+"$"+payrate*workhour);//outputpayrate ("所纳税款:");//outputDeductions ("联邦税"+"("+federalrate*100+"%"+")"+":"+"$"+workhour*payrate*federalrate); ("州税"+"("+staterate*100+"%"+")"+":"+"$"+workhour*payrate*staterate); ("总纳税:"+"$"); ("%.2f\n",workhour*payrate*(+));("净收入:"+"$");("%.2f",workhour*payrate*(--));}}GUI界面/***@(#)******@author****@/
实验报告实验一 来自淘豆网m.daumloan.com转载请标明出处.