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 district int 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 earlier districtno = sc.nextInt(); System.out.print("Enter "+ districtno + " name of district in state : "); //ask user for name of districts in the state given String[] name = new String[districtno]; for (int i = 0; i < name.length; i++) { name[i] = sc.next(); } System.out.print("Enter "+ districtno + " first total cases reading : "); //ask user for the first total cases reading int[] firsttotal = new int[districtno]; for (int i = 0; i < firsttotal.length; i++) { firsttotal[i] = sc.nextInt(); } System.out.print("Enter "+ districtno + " second total cases reading : "); //ask user for the second total cases reading int[] secondtotal = new int[districtno]; for (int i = 0; i < secondtotal.length; i++) { 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; i++) { 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; i++) { 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; i++) { 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; i++) { totalcases = firsttotal[i] + secondtotal[i]; //calculate total cases of first and second newtotalcases[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; i++) { sumcases = sumcases + firsttotal[i] + secondtotal[i]; //calculate the average of total cases based on first and second total average = 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 < 10) { remarks = zone1; } else if (totalcases > 10 && totalcases < 30) { remarks = zone2; } else { remarks = zone3; } int cluster = 0; //find the total cluster for (int i = 0; i < districtno; i++) { if (newtotalcases[i] < 10) { remarks = zone1; } if (newtotalcases[i] >= 10 && totalcases <= 30) { 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, remarks for (int i = 0; i < districtno; i++) { totalcases = firsttotal[i] + secondtotal[i]; newtotalcases[i]= totalcases; if (newtotalcases[i] < 10) { remarks = zone1; } if (newtotalcases[i] >= 10 && newtotalcases[i] <= 30) { 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; i++) { totalcases = firsttotal[i] + secondtotal[i]; //sum the first and second total cases for each district before comparing if (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 cases System.out.print("\n"); System.out.print("\t\tDistrict: "+highestdistrict); //display to user the district of the highest number of cases } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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 district
int 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 earlier
districtno = sc.nextInt();
System.out.print("Enter "+ districtno + " name of district in state : "); //ask user for name of districts in the state given
String[] name = new String[districtno];

for (int i = 0; i < name.length; i++)
{
name[i] = sc.next();
}

System.out.print("Enter "+ districtno + " first total cases reading : "); //ask user for the first total cases reading
int[] firsttotal = new int[districtno];

for (int i = 0; i < firsttotal.length; i++)
{
firsttotal[i] = sc.nextInt();
}

System.out.print("Enter "+ districtno + " second total cases reading : "); //ask user for the second total cases reading
int[] secondtotal = new int[districtno];

for (int i = 0; i < secondtotal.length; i++)
{
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; i++)
{
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; i++)
{
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; i++)
{
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; i++)
{
totalcases = firsttotal[i] + secondtotal[i]; //calculate total cases of first and second
newtotalcases[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; i++)
{
sumcases = sumcases + firsttotal[i] + secondtotal[i]; //calculate the average of total cases based on first and second total
average = 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 < 10)
{
remarks = zone1;
}
else if (totalcases > 10 && totalcases < 30)
{
remarks = zone2;
}
else
{
remarks = zone3;
}


int cluster = 0; //find the total cluster
for (int i = 0; i < districtno; i++)
{
if (newtotalcases[i] < 10)
{
remarks = zone1;
}
if (newtotalcases[i] >= 10 && totalcases <= 30)
{
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, remarks
for (int i = 0; i < districtno; i++)
{
totalcases = firsttotal[i] + secondtotal[i];
newtotalcases[i]= totalcases;

if (newtotalcases[i] < 10)
{
remarks = zone1;
}

if (newtotalcases[i] >= 10 && newtotalcases[i] <= 30)
{
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; i++)
{
totalcases = firsttotal[i] + secondtotal[i]; //sum the first and second total cases for each district before comparing

if (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 cases
System.out.print("\n");
System.out.print("\t\tDistrict: "+highestdistrict); //display to user the district of the highest number of cases
}
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Adjacency Matrix
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education