Wa0031.
Wa0031.
Wa0031.
COOPER ROUND II
Problem Statement:
class User{
String userEmail;
String userName;
int zoneId;
int streetId;
class Zone{
static int count = 0;
int zoneId;
//private int activeCases;
int activeCases;
int recoveredCases;
int deceasedCases;
Zone(){
zoneId = ++count;
activeCases = 0;
recoveredCases = 0;
deceasedCases = 0;
}
class Hospital{
static int count = 0;
int hospitalId;
String hospitalName;
boolean isCovidFacilities;
int zoneId;
class TestData{
static int count;
int requestId;
String userEmail;
int hospitalId;
boolean isInHome;
boolean isDone;
boolean isPositive;
class Range{
int rangeId;
int redZoneRange;
int orangeZoneRange;
//int greenZoneRange;
Range(){
redZoneRange = 50;
orangeZoneRange = 10;
//greenZoneRange =
}
}
class CovidHelper{
public static void main(String[] args){
System.out.println("\n\nWelcome to Covid Helper :)");
// sample inputs
//zone
System.out.println("Creating zones...");
ArrayList<Zone> zoneList = new ArrayList<Zone>();
for(int i=1; i<=5; i++){
zoneList.add(new Zone());
}
for(int i=0; i<5; i++){
System.out.println(zoneList.get(i));
}
System.out.println("Zones created...");
//streets
System.out.println("Creating streets inside
zones...");
ArrayList<Street> streetList = new
ArrayList<Street>();
char s_name ='A';
for(int i=0; i<5; i++){
for(int j=0; j<2; j++){
streetList.add(new Street(i, s_name +
""+s_name));
s_name++;
}
}
for(Street s: streetList){
System.out.println(s);
}
System.out.println("Creating hospitals inside
zones...");
ArrayList<Hospital> hospitalList = new
ArrayList<Hospital>();
char h_name ='a';
boolean temp = true;
int x=1;
for(Zone z: zoneList){
hospitalList.add(new Hospital(h_name + ""+h_name,
temp, x++ ));
h_name++;
temp = !temp;
}
for(Hospital h: hospitalList){
System.out.println(h);
}
System.out.println("Hospitals Created...");
// users
for(Street s: streetList){
for(int i=0; i<2; i++){
userList.add(new User(u_email+""+_u_email,
u_name +""+u_name, s.zoneId, s.streetId));
u_name++;
u_email++;
}
}
for(User u: userList){
System.out.println(u);
}
System.out.println("Users created");
// Test data
System.out.println("Creating test data");
Name : Kartheeswaran S
Phone : 9566545006
Email : [email protected]