You must design a COVID-19 screening application for your campus. The guards at each gate will screen the students . The capabilities and features of the application should include a choice between the following functions:
1. A screening survey which will allow guards to record the students’ screening data.
*No student should be allowed access to the campus after 12h00 in the afternoons regardless of whether capacity has been reached or not.
*If a student’s temperature is 38 degrees or more, they will not be allowed entry into the campus.
Write the pseudocode that will accurately represent the application you are designing.
Pseudocode
Start
Declare constant CAMPUS_CAPACITY=300
Declare array names
Declare array times
Declare array temperatures
Declare variable counter = 0
Declare variable choice = -1
while choice <> 3
Print "1. Add a new student"
Print "2. Show all students"
Print "3. Exit"
Print "Your choice: "
Read choice from the keyboard
if choice = 1
if counter<CAMPUS_CAPACITY
Read the student name from the keyboard
Read the student hours from the keyboard
Read the student minutes from the keyboard
Read the student temperature from the keyboard
if temperature >= 38 or temperature < 34
Print "The student's temperature is 38 degrees or more, he/she will not be allowed entry into the campus.");
else if hour < 1 or minutes < 0 or hour > 12 or minutes > 59
Print "No student should be allowed access to the campus after 12h00 in the afternoons."
else
Add information about student to arrays
counter=counter+1
else
Print "The capacity of campus has been reached."
else if choice == 2
for i = 0 to counter
Print "The student name: " + names(i)
Print "The student time: " + times(i)
Print "The student temperature: " + temperatures(i)
else if (choice = 3)
else
Print "Select correct menu item."
Stop
import java.util.Scanner;
public class Q194543 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
final int CAMPUS_CAPACITY=300;
String names[] = new String[CAMPUS_CAPACITY];
String times[] = new String[CAMPUS_CAPACITY];
int temperatures[] = new int[CAMPUS_CAPACITY];
int counter = 0;
int choice = -1;
while (choice != 3) {
System.out.println("1. Add a new student");
System.out.println("2. Show all students");
System.out.println("3. Exit");
System.out.print("Your choice: ");
choice = in.nextInt();
if (choice == 1) {
in.nextLine();
if(counter<CAMPUS_CAPACITY) {
System.out.print("Enter the student name: ");
names[counter] = in.nextLine();
System.out.print("Enter hours: ");
int hour = in.nextInt();
System.out.print("Enter minutes: ");
int minutes = in.nextInt();
System.out.print("Enter temperature: ");
int temperature = in.nextInt();
if (temperature >= 38 || temperature < 34) {
System.out.println("The student's temperature is 38 degrees or more, he/she will not be allowed entry into the campus.");
} else if (hour < 1 || minutes < 0 || hour > 12 || minutes > 59) {
System.out.println("No student should be allowed access to the campus after 12h00 in the afternoons.");
} else {
times[counter] = hour + ":" + minutes;
temperatures[counter] = temperature;
counter++;
}
}else {
System.out.println("The capacity of campus has been reached.");
}
} else if (choice == 2) {
for (int i = 0; i < counter; i++) {
System.out.println("The student name: " + names[i]);
System.out.println("The student time: " + times[i]);
System.out.println("The student temperature: " + temperatures[i] + "\n");
}
} else if (choice == 3) {
} else {
System.out.println("Select correct menu item.");
}
}
in.close();
}
}
Comments
Leave a comment