资 源 简 介
编写程序计算三门课的平均成绩,要求应用程序分别用Java语言三种不同的循环语句实现,每门课的成绩用Math类的random()方法随机产生(random()产生的数值在0和1之间),成绩范围为40~100。
提示:自定义一个类,该类实现一个返回随机数的函数。在main函数里测试时直接调用该类的获取随机数方法。 获得随机数相关的类为:java.lang.Math 需要时可引入该类即:import java.lang.Math
-Write a program grade point average calculation of three lessons to require the application were used Java language in three different loop realization of the achievements of each course with the Math class, random () method of randomly generated (random () produces values between 0 and between 1), results range from 40 ~ 100. Tip: Customize a class that implements a function to return random numbers. In the main function, where the test is called the class to obtain a direct method of random numbers. Obtain a random number associated category: java.lang.Math necessary for the introduction of the class that is: import java.lang.Math