📜  用于检查 TPP 学生参加面试资格的Java程序

📅  最后修改于: 2022-05-13 01:55:43.756000             🧑  作者: Mango

用于检查 TPP 学生参加面试资格的Java程序

问题陈述:这是一个Java程序,用于定位和面试标准,例如在线测试将出现多少学生,学术成绩和Amcat分数等。 根据代码中设置的标准,很容易检查谁符合条件出现在谷歌、亚马逊和微软等跨国公司中。

概念:直接应用朴素的方法,其中包括数组和字符串的概念在实现过程中发挥作用,以实现目标。

程序:

  1. 让一个Java类说它相关地命名为'interview'。
  2. 输入 UID、姓名、GPA、Amcat 分数。
  3. 设置资格标准如下所示,以演示实施。
    • 如果GPA在7以上,并且Amcat分数在600以上
      • 然后学生有资格参加谷歌面试。
    • 如果 GPA 在 7.5 以上,并且 Amcat 分数在 750 以上
      • 然后该学生有资格参加 Microsoft 面试。
    • 如果GPA在8以上,Amcat成绩在700以上
      • 然后学生有资格参加亚马逊面试。

标准的图示如下:

插图:

例子

Java
// Importing Scanner class to
// take input from th user
import java.util.Scanner;
 
// Class
public class interview {
 
    // Main driver method
    public static void main(String[] args)
    {
 
        // Creating an object of Scanner class
        // to read input fom keyboard
        Scanner sc = new Scanner(System.in);
 
        // Display message for better readability
        System.out.print(
            "Enter number of Students who have taken TPP: ");
 
        // Reading and storing primitive value
        // Integer type using nextInt() method
        int n = sc.nextInt();
 
        // Creating arrays
        String[] ar = new String[n];
        String[] arr = new String[n];
        double[] arr1 = new double[n];
 
        int[] arr2 = new int[n];
 
        double[] s1 = new double[n];
        double[] s2 = new double[n];
        double[] s3 = new double[n];
 
        // Iterating over th input values
        // as received from user
        for (int i = 0; i < n; i++) {
            sc.nextLine();
            System.out.print("Enter UID of Student "
                             + (i + 1) + ": ");
            ar[i] = sc.nextLine();
            System.out.print("Enter Name of Student "
                             + (i + 1) + ": ");
            arr[i] = sc.nextLine();
            System.out.print("Enter CGPA of Student "
                             + (i + 1) + ": ");
            arr1[i] = sc.nextDouble();
            System.out.print("Enter AMCAT Score of Student "
                             + (i + 1) + ": ");
            arr2[i] = sc.nextInt();
            System.out.print("\n");
        }
 
        System.out.println(
            "\nFor Google Students having CGPA above 7.00 and AMCAT score above 600 are eligible for further tests");
        System.out.println("\nShortlisted Students are:");
        System.out.print(
            "UID\t\t\tName\t\t\tCGPA\t\tAMCAT\n");
        for (int i = 0; i < n; i++) {
            if (arr1[i] >= 7.00) {
                if (arr2[i] >= 600) {
                    System.out.printf(
                        "%-12s%-16s%-12f%-6d\n", ar[i],
                        arr[i], arr1[i], arr2[i]);
                }
            }
        }
 
        System.out.println(
            "\nFor Microsoft Students having CGPA above 7.50 and AMCAT score above 750 are eligible for further tests");
        System.out.println("\nShortlisted Students are:");
        System.out.print(
            "UID\t\t\tName\t\t\tCGPA\t\tAMCAT\n");
        for (int i = 0; i < n; i++) {
            if (arr1[i] >= 7.50) {
                if (arr2[i] >= 750) {
                    System.out.printf(
                        "%-12s%-16s%-12f%-6d\n", ar[i],
                        arr[i], arr1[i], arr2[i]);
                }
            }
        }
 
        System.out.println(
            "\nFor Amazon Students having CGPA above 8.00 and AMCAT score above 700 are eligible for further tests");
        System.out.println("\nShortlisted Students are:");
        System.out.print(
            "UID\t\t\tName\t\t\tCGPA\t\tAMCAT\n");
        for (int i = 0; i < n; i++) {
            if (arr1[i] >= 8.00) {
                if (arr2[i] >= 700) {
                    System.out.printf(
                        "%-12s%-16s%-12f%-6d\n", ar[i],
                        arr[i], arr1[i], arr2[i]);
                }
            }
        }
 
        System.out.print(
            "\nEnter Coding test Scores for Google:");
        for (int i = 0; i < n; i++) {
            if (arr1[i] >= 7.00) {
                if (arr2[i] >= 600) {
                    System.out.print(
                        "\nEnter Coding Test score of UID "
                        + ar[i] + ": ");
                    s1[i] = sc.nextDouble();
                }
            }
        }
 
        System.out.print(
            "\nEnter Coding test Scores for Microsoft:");
        for (int i = 0; i < n; i++) {
            if (arr1[i] >= 7.50) {
                if (arr2[i] >= 750) {
                    System.out.print(
                        "\nEnter Coding Test score of UID "
                        + ar[i] + ": ");
                    s2[i] = sc.nextDouble();
                }
            }
        }
        System.out.print(
            "\nEnter Coding test Scores for Amazon:");
        for (int i = 0; i < n; i++) {
            if (arr1[i] >= 8.00) {
                if (arr2[i] >= 700) {
                    System.out.print(
                        "\nEnter Coding Test score of UID "
                        + ar[i] + ": ");
                    s3[i] = sc.nextDouble();
                }
            }
        }
 
        System.out.println(
            "\nStudents eligible to sit for Google interview ");
        System.out.print(
            "UID\t\t\tName\t\t\tCGPA\t\tAMCAT\n");
        for (int i = 0; i < n; i++) {
            if (arr1[i] >= 7.00) {
                if (arr2[i] >= 600) {
                    if (s1[i] > 80) {
                        System.out.printf(
                            "%-12s%-16s%-12f%-6d\n", ar[i],
                            arr[i], arr1[i], arr2[i]);
                    }
                }
            }
        }
 
        System.out.println(
            "\nStudents eligible to sit for Microsoft interview ");
        System.out.print(
            "UID\t\t\tName\t\t\tCGPA\t\tAMCAT\n");
        for (int i = 0; i < n; i++) {
            if (arr1[i] >= 7.50) {
                if (arr2[i] >= 750) {
                    if (s1[i] > 70) {
                        System.out.printf(
                            "%-12s%-16s%-12f%-6d\n", ar[i],
                            arr[i], arr1[i], arr2[i]);
                    }
                }
            }
        }
        System.out.println(
            "\nStudents eligible to sit for Amazon interview ");
        System.out.print(
            "UID\t\t\tName\t\t\tCGPA\t\tAMCAT\n");
        for (int i = 0; i < n; i++) {
            if (arr1[i] >= 8.00) {
                if (arr2[i] >= 700) {
                    if (s1[i] > 80) {
                        System.out.printf(
                            "%-12s%-16s%-12f%-6d\n", ar[i],
                            arr[i], arr1[i], arr2[i]);
                    }
                }
            }
        }
    }
}