Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please write a code that will look like this. You CANNOT use ArrayLists or any t

ID: 3726444 • Letter: P

Question

Please write a code that will look like this. You CANNOT use ArrayLists or any type of List to store objects, Breaks, or continue statemets throughout the entire project. PLEASE only use basic Arrays Correctly use the “Prime the Read” method for inputting data before a sentinel loop. Note: You may not use any break or continue statements in your program to earn these points.

like- (Items in green/underline are the user inputs. Your program should not print these items) Example Output (No patient data) Welcome to the Flu Tracker Type of the name of the Influenza Type (x to exit) Summary information There were: 0 cases of Flu to summarize Example Output (With patient data Welcome to the Flu Tracker Type of the name of the Influenza Type (x to exit) What is the age of the patient? 15 Next Patient Type of the name of the Influenza Type (x to exit) What is the age of the patient? 87 Next Patient Type of the name of the Influenza Type (x to exit) H1N1 What is the age of the patient? Next Patient Type of the name of the Influenza Type (x to exit) What is the age of the patient? 37 Next Patient Type of the name of the Influenza Type (x to exit) Summary information Type: Influenza-AAge: 15 Type: Influenza-B Age: 87 Type: H1N1 Type: Influenza-AAge: 37 There were: 4 cases of Influenza with an average age of 35

Explanation / Answer

import java.util.Scanner; public class Influenza { public static void main(String[] args) { Scanner in = new Scanner(System.in); int capacity = 1000; String[] fluList = new String[capacity]; int[] ageList = new int[capacity]; String flu; int age; int size = 0; System.out.println("Welcome to the Flu Tracker."); System.out.println("Type of the name of the Influenza Type (x to exit)"); flu = in.next(); while (!flu.equalsIgnoreCase("x")) { System.out.println("What is the age of the patient?"); age = in.nextInt(); fluList[size] = flu; ageList[size++] = age; System.out.println("Next Patient"); System.out.println("Type of the name of the Influenza Type (x to exit)"); flu = in.next(); } System.out.println("Summary information"); if(size == 0) { System.out.println("There were: 0 cases of Flu to summarize"); } else { int avg = 0; for(int i = 0; i