云南大学软件学院
实验报告
姓名:学号:班级:日期:成绩:
JAVA实验二
一、实验目的:
进一步熟悉JAVA编译环境,编译三个简单的JAVA程序,熟悉JAVA语言。
二、实验要求:
1. Write Java program called AverageNumbers.java to determine the average of
several numbers.
Set the following five integer variables:
int1 = 5
int2 = 7
int3 = 4
int4 = 25
int5 = 13
Calculate and display the average of these numbers and the square root of average.
2. Write a temperature conversion Java program called FarheheitToCentigrade.java.
Set a variable called tempFarenheit = 98.6.
Calculate the Centigrade temp (tempCelcius) by using the formula Centigrade = 5/9 (Fahrenheit -32)
3.Write a Java payroll program called Payroll.java that determines pay and taxes.
Set the following variables:
pay = $25 per hour
hoursWorked = 40
Calculate grossPay by multiplying pay * hoursWorked.
Calculate taxesWithheld by multiplying grossPay * .15.
Calculate netPay by subtracting taxesWithheld from grossPay.
Display all variables.
三、实验内容:
1.