Aquapodz2.java - import [email protected]

This preview shows page 1 - 3 out of 5 pages.

import java.util.Scanner; /** * @author devyn * @version 10/12/2020 */ public class Aquapodz2 { /** * We need to go deeper! * Now with bonus content! * * @param args tests materials */ public static void main(String[] args) { String command; Scanner sc = new Scanner(System.in); System.out.println("Please enter a command:"); command = sc.next(); int i; int azuFail = 0; int bubFail = 0; int cryFail = 0; double[] azu = new double[15]; double[] bub = new double[15]; double[] cry = new double[15]; double higha; double highb; //high values double highc; int k = 0; //loops for a int o = 0; double suma = 0; //sum for a double averagea = 0; //average for a double[] storea = new double[15]; //store for a int j = 0; //loops for b int t = 0; double sumb = 0; double averageb; double[] storeb = new double[15]; int h = 0; //loops for c int u = 0; double sumc = 0; double averagec = 0; double[] storec = new double[15]; double allcount = 0; // failures added up double allFail = 0; double averageFail = 0; int allInputs = 0; while (!command.equals("x")) { if (command.equals("a")) { for (i = 0; i < 3; ++i) { System.out.println("Enter number " + (i + 1) + ":"); azu[i] = sc.nextDouble(); storea[k] = azu[i]; ++k; ++o; ++allInputs; }
System.out.println("Please enter a command:"); command = sc.next(); for (i = 0; i < 3; ++i) { if (azu[i] < -6.0 || azu[i] > 12.3) { ++azuFail; allcount = allcount + azu[i]; } } } else if (command.equals("b")) { for (i = 0; i < 3; ++i) { System.out.println("Enter number " + (i + 1) + ":"); bub[i] = sc.nextDouble(); storeb[j] = bub[i]; ++j; ++t; ++allInputs; } System.out.println("Please enter a command:"); command = sc.next(); for (i = 0; i < 3; ++i) { if (bub[i] < -6.0 || bub[i] > 12.3) { ++bubFail; allcount = allcount + bub[i]; } } } else if (command.equals("c")) { for (i = 0; i < 3; ++i) { System.out.println("Enter number " + (i + 1) + ":"); cry[i] = sc.nextDouble(); storec[h] = cry[i];

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture