47 lines
1.1 KiB
Java
47 lines
1.1 KiB
Java
import java.text.DecimalFormat;
|
|
|
|
public class CovidEntry {
|
|
|
|
//Private vars
|
|
private String state;
|
|
private int month, day;
|
|
private int dailyDeaths, dailyInfections;
|
|
private int totalDeaths, totalInfections;
|
|
private static DecimalFormat df;
|
|
|
|
//Constructor
|
|
public CovidEntry(String st, int m, int d, int di, int dd,
|
|
int ti, int td){
|
|
this.state = st;
|
|
this.month = m;
|
|
this.day = d;
|
|
this.dailyInfections = di;
|
|
this.dailyDeaths = dd;
|
|
this.totalDeaths = td;
|
|
this.totalInfections = ti;
|
|
|
|
df = new DecimalFormat("#,###,###");
|
|
}
|
|
|
|
//accessors
|
|
public int getMonth(){return month;}
|
|
|
|
public int getDay(){return day;}
|
|
|
|
public String getState(){return state;}
|
|
|
|
public int getDailyInfections(){return dailyInfections;}
|
|
|
|
public int getDailyDeaths(){return dailyDeaths;}
|
|
|
|
public int getTotalDeaths(){return totalDeaths;}
|
|
|
|
public int getTotalInfections(){return totalInfections;}
|
|
public String toString(){
|
|
return state + " " + month + "/" + day + " " +
|
|
df.format(dailyInfections) + " infections, " +
|
|
df.format(dailyDeaths) + " deaths";
|
|
}
|
|
|
|
}
|