Advertisement
Spode

Test Results Program

Apr 26th, 2019
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.91 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class main {
  4.  
  5.      public static void main(String[] args) {
  6.         double[] pass = dataInput();
  7.         tableDisplay(pass);
  8.       }
  9.  
  10.       public static void tableDisplay(double[] ph /* ph means "placeholder" */) {
  11.        
  12.         String tableGrid =
  13.                 "| Test Results 3/5/19\n" +
  14.                 "|:-------------------:|---------------------|---------------------|\n" +
  15.                 "|      Component      |   My Value          |    Standard Range   |\n" +
  16.                 "|:-------------------:|---------------------|---------------------|\n" +
  17.                 "|          LH         | "+ph[0]+" mIU/mL          |   1.7 - 8.6 mIU/mL  |\n" +
  18.                 "|         FSH         | "+ph[1]+" mIU/mL          |  1.5 - 12.4 mIU/mL  |\n" +
  19.                 "|     Testosterone    | "+ph[2]+"  ng/dL          |   264 - 916 ng/dL   |\n" +
  20.                 "|      Prolactin      | "+ph[3]+" ng/mL           |   4.0 - 15.2 ng/mL  |\n" +
  21.                 "|      Estradiol      | "+ph[4]+" pg/mL           |   7.6 - 42.6 pg/mL  |\n" +
  22.                 "|         TSH         | "+ph[5]+" uIU/mL          | 0.450 - 4.50 uIU/mL |\n" +
  23.                 "|:-------------------:|---------------------|---------------------|";
  24.                            
  25.         System.out.printf(tableGrid);
  26.       }
  27.  
  28.       public static double[] dataInput() {
  29.         Scanner input = new Scanner(System.in);
  30.         System.out.printf("Enter value for LH : ");
  31.         double LH = input.nextDouble(); // ← LN
  32.         System.out.printf("Enter value for FSH : ");
  33.         double FSH = input.nextDouble(); // ← FSH
  34.         System.out.printf("Enter value for Testosterone : ");
  35.         double TES = input.nextDouble(); // ← Testosterone
  36.         System.out.printf("Enter value for Prolactin : ");
  37.         double PRO = input.nextDouble(); // ← Prolactin
  38.         System.out.printf("Enter value for Estradiol : ");
  39.         double EST = input.nextDouble(); // ← Estradiol
  40.         System.out.printf("Enter value for TSH : ");
  41.         double TSH = input.nextDouble(); // ← TSH
  42.         double [] dataValue = {LH, FSH, TES, PRO, EST, TSH};
  43.         return dataValue;
  44.       }
  45.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement