java变量实验代码 java变量写法

求JAVA实验代码public interface Student {
// 该方法用于表示不同阶段的学生在学习数学课程时的不同内容
public abstract void studyMath();
// 该方法用于表示不同阶段的学生的英语水平
public abstract void studyEnglish();
}
public class PrimarySchoolStudent implements Student {
@Override
public void studyMath() {
System.out.println("小学生在学习数学课程时,主要学习加减法,数学表达式等基础知识 。");
}
@Override
public void studyEnglish() {
System.out.println("小学生在学习英语时 , 主要学习词汇,基本句型,基本语法等基础知识 。");
}
}
public class MiddleSchoolStudent implements Student {
@Override
public void studyMath() {
System.out.println("中学生在学习数学课程时,主要学习初等函数,代数方程等基础知识 。");
}
@Override
public void studyEnglish() {
System.out.println("中学生在学习英语时,主要学习阅读理解,听力理解,口语交流等能力 。");
}
}
public class CollegeStudent implements Student {
@Override
public void studyMath() {
System.out.println("大学生在学习数学课程时 , 主要学习高等数学,概率论,数值计算等专 。");
}
@Override
public void studyEnglish() {
System.out.println("大学生在学习英语时,主要学习专业英语,商务英语 , 英文写作等能力 。");
}
}
public class Main {
public static void main(String[] args) {
求几个简单的JAVA代码,关于变量的import java.util.Scanner;
public class Variate {
/**
* 数字排序
*/
public static void variate1(){
Scanner in = new Scanner(System.in);
System.out.println("请输入第一个数字java变量实验代码:");
float first = in.nextFloat();
System.out.println("请输入第二个数字java变量实验代码:");
float second = in.nextFloat();
System.out.println("请输入第三个数字:");
float third = in.nextFloat();
if(first - second = 0){
if(second - third = 0){
System.out.println("三个数字从大到小顺序为:" + first + "=" + second + "=" + third);
}else if(first - third = 0){
System.out.println("三个数字从大到小顺序为:" + first + "=" + third + "=" + second);
}else{
System.out.println("三个数字从大到小顺序为:" + third + "=" + first + "=" + second);
}
}else if(first - third = 0){
System.out.println("三个数字从大到小顺序为:" + second + "=" + first + "=" + third);
}else if(second - third = 0){
System.out.println("三个数字从大到小顺序为:" + second + "=" + third + "=" + first);
}else{
System.out.println("三个数字从大到小顺序为:" + third + "=" + second + "=" + first);
}
}
/**
* 利率计算
*/
public static double bonus(){
【java变量实验代码 java变量写法】float profit = 0;
double bonus = 0;
Scanner in = new Scanner(System.in);
System.out.println("请输入利润(万元):");
profit = in.nextFloat();
if(profit = 10){
bonus = profit * 0.1;
}else if(profit10profit = 20){
bonus = (profit - 10) * 0.075 + 10 * 0.1;
}else if(profit20profit = 40){
bonus = (profit - 20) * 0.05 + 20 * 0.1;
}else if(profit40profit = 60){
bonus = (profit - 40) * 0.03 + 40 * 0.1;
}else if(profit60profit = 100){
bonus = (profit - 60) * 0.015 + 60 * 0.1;
}else if(profit100){
bonus = (profit - 100) * 0.01 + 100 * 0.1;
}
return bonus;
}
/**
* 判断元辅音字母
*/
public static void variate2(){

推荐阅读