Question : Write the pseudocode for the JAVA program below
import java.util.Scanner;public class covidtest{public static void main(String[] args){Scanner sc = new Scanner(System.in);String State, zone; //declare and input districtint districtno, sumcases = 0, totalcases = 0, average = 0;//ask for all information needed from user//System.out.print("Enter no of district in the state : "); //ask user for total number of district of the state given by user earlierdistrictno = sc.nextInt();System.out.print("Enter "+ districtno + " name of district in state : "); //ask user for name of districts in the state givenString[] name = new String[districtno];for (int i = 0; i < name.length;="">{name[i] = sc.next();}System.out.print("Enter "+ districtno + " first total cases reading : "); //ask user for the first total cases readingint[] firsttotal = new int[districtno];for (int i = 0; i < firsttotal.length;="">{firsttotal[i] = sc.nextInt();}System.out.print("Enter "+ districtno + " second total cases reading : "); //ask user for the second total cases readingint[] secondtotal = new int[districtno];for (int i = 0; i < secondtotal.length;="">{secondtotal[i] = sc.nextInt();}System.out.print("\n");System.out.print("\t\t**************************************");System.out.print("\n");System.out.print("\n");System.out.print("\n");System.out.print("\n");System.out.print("\n");System.out.print("\t\tList of district : \n");for (int i = 0; i < name.length;="">{System.out.print("\t\t" + name[i]); //list out the district name for user}//display to user the first total reading given by user//System.out.print("\n");for (int i = 0; i < firsttotal.length;="">{System.out.print("\t\t"+ firsttotal[i] + "\t");}//display to user the second total reading given by user//System.out.print("\n");for (int i = 0; i < secondtotal.length;="">{System.out.print("\t\t"+ secondtotal[i] + "\t");}//display total for each district of both first and second readings//System.out.print("\n");int[] newtotalcases = new int [districtno];for (int i = 0; i < districtno;="">{totalcases = firsttotal[i] + secondtotal[i]; //calculate total cases of first and secondnewtotalcases[i] = totalcases;System.out.print("\t\t"+ totalcases + "\t");}//find average for first and second total readings obtained//System.out.print("\n");for (int i = 0; i < districtno;="">{sumcases = sumcases + firsttotal[i] + secondtotal[i]; //calculate the average of total cases based on first and second totalaverage = sumcases / districtno;}System.out.print("\n\t\tAverage cases for today is: "+ average);System.out.print("\n\n");//determine cluster//String remarks, zone1 = "Green Zone", zone2 = "Yellow Zone", zone3 = "cluster";if (totalcases <>{remarks = zone1;}else if (totalcases > 10 && totalcases <>{remarks = zone2;}else{remarks = zone3;}int cluster = 0; //find the total clusterfor (int i = 0; i < districtno;="">{if (newtotalcases[i] <>{remarks = zone1;}if (newtotalcases[i] >= 10 && totalcases <=>=>{remarks = zone2;}if (newtotalcases[i] > 30){cluster = cluster + 1;remarks = zone3;}}System.out.print("\t\tTotal cluster for today: "+ cluster);System.out.print("\n\t\tFinal report of Covid-19 cases today: ");System.out.print("\n\n");System.out.print("\t\tdistrict\ttotal cases\tremarks");//display name district, total cases, remarksfor (int i = 0; i < districtno;="">{totalcases = firsttotal[i] + secondtotal[i];newtotalcases[i]= totalcases;if (newtotalcases[i] <>{remarks = zone1;}if (newtotalcases[i] >= 10 && newtotalcases[i] <=>=>{remarks = zone2;}if (newtotalcases[i] > 30){remarks = zone3;}System.out.print("\n\t\t"+ name[i] +"\t\t"+ newtotalcases[i] +"\t\t"+ remarks);}//determine the highest cases and its district name//int highestcases = 0;String highestdistrict = "";for (int i = 0; i < districtno;="">{totalcases = firsttotal[i] + secondtotal[i]; //sum the first and second total cases for each district before comparingif (totalcases > highestcases) //compare sum of each district obtained to each other to get the highest number of cases{highestcases = totalcases;highestdistrict = name[i];}}System.out.print("\n\n");System.out.print("\t\tHighest cases for Covid-19 today: "+ highestcases); //display to user the highest number of casesSystem.out.print("\n");System.out.print("\t\tDistrict: "+highestdistrict); //display to user the district of the highest number of cases}}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here