+ 1

can someone help me in java project

i am trying to write a class named covid_19 with three drived class from it and one class named country that have an arrayList of covid_19 class

27th Apr 2020, 10:44 PM
Anas Omari
Anas Omari - avatar
7 odpowiedzi
+ 6
We can help you, but only in an assistant function. Please create some code. If problems come up, ask us, we'll try to give you a hint.
27th Apr 2020, 10:47 PM
HonFu
HonFu - avatar
+ 2
ok i will attach my code here
27th Apr 2020, 10:48 PM
Anas Omari
Anas Omari - avatar
+ 2
Anas Omari Okay lets say you already have a list with active cases. ArrayList<ActiveCase> active = new ArrayList<>(); public void setCase(boolean status){ active.get(index).setStatusOfCase(status); } You need to think about how to get the index. Or in other words, you need to find a way to identify the correct case.
28th Apr 2020, 1:31 AM
Denise Roßberg
Denise Roßberg - avatar
+ 1
this is my code for Five class // COVID_19 class public class COVID_19 { private String infectionDate; private String commonSigns; //fever, dry cough, and shortness of breath public COVID_19( String commonSigns, String infectionDate) { this.infectionDate = infectionDate; this.commonSigns = commonSigns; } } //Active case class public class ActiveCase extends COVID_19 { private boolean statusOfCase ; public ActiveCase(String commonSigns,String infectionDate,boolean statusOfCase) { super(commonSigns, infectionDate); this.statusOfCase = statusOfCase; } } // Recovered case Class public class RecoveredCase extends COVID_19 { protected String dateOfRecovered; public RecoveredCase( String commonSigns,String infectionDate, String dateOfRecovered) { super(commonSigns,infectionDate); this.dateOfRecovered = dateOfRecovered; } } // Death case class public class DeathCase extends COVID_19 { protected String dateOfDied; public DeathCase(String commonSigns, String infectionDate, String dateOfDied) { super(commonSigns,infectionDate); this.dateOfDied = dateOfDied; } } //Country class public class Country { private String CountryName; private int numberOfCase=0; private ArrayList<COVID_19> COVID_19CasesList; public Country(String CountryName) { this.CountryName = CountryName; COVID_19CasesList=new ArrayList<COVID_19>(); } ================== All class's with its setter and getter methods Now my Question is about how can i create method in country class to modify the state of active case from True to false and other method to reload the active case as recovered case's and count number of cases for each country thanks for your help :)
27th Apr 2020, 11:16 PM
Anas Omari
Anas Omari - avatar
+ 1
Hello Anas Omari ArrayList<ActiveCase> active = new ArrayList<>(); I would write a method to fill the list with active cases. Then you can write another method to set the status of each ActiveCase. But I am not sure how you want to get the data. I guess you will need a file to store the data of all cases.
28th Apr 2020, 12:21 AM
Denise Roßberg
Denise Roßberg - avatar
0
class country should include a method to modify the status of an active case at a specifed position in the list of cases
28th Apr 2020, 12:51 AM
Anas Omari
Anas Omari - avatar
0
yes this is my problem, because the Covid_19List not looking to the method of child class
28th Apr 2020, 1:40 AM
Anas Omari
Anas Omari - avatar