Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.util.SparseArray;

public class Main {
    private static double getTheoreticalStudent(int n) {
        SparseArray<Double> theorStudent = new SparseArray<Double>();
        theorStudent.put(10, 2.2281389);
        theorStudent.put(20, 2.0859634);
        theorStudent.put(30, 2.0422725);
        theorStudent.put(40, 2.0210754);
        theorStudent.put(50, 2.0085591);
        theorStudent.put(60, 2.0002978);
        theorStudent.put(70, 1.9944371);
        if (n >= 70)
            return theorStudent.get(70);
        else if (n >= 60)
            return theorStudent.get(60);
        else if (n >= 50)
            return theorStudent.get(50);
        else if (n >= 40)
            return theorStudent.get(40);
        else if (n >= 30)
            return theorStudent.get(30);
        else if (n >= 20)
            return theorStudent.get(20);
        else if (n >= 10)
            return theorStudent.get(10);
        else
            return theorStudent.get(10);
    }
}