I'm trying to create a basic calculation program using user input (pretty much just my own) and handling very minimal calculations. I can't seem to get the calculation to return though. I'm doing all of my calculations in this file:
public class Drug {
private double goalForQuarter = 3716.0;
private double currentScripts;
private double currentDaysIntoQuarter;
private double scriptsNeededDaily100 = goalForQuarter / currentDaysIntoQuarter;
private double scriptsNeededDaily105 = scriptsNeededDaily100 * 1.05;
private double scriptPercentage = currentScripts / scriptsNeededDaily100;
public Drug () {
}
public Drug (double currentScripts) {
this.currentScripts = currentScripts;
}
public Drug (double currentScripts, double currentDays){
this.currentScripts = currentScripts;
this.currentDaysIntoQuarter = currentDays;
}
public double calcDrug100 (){
return this.scriptPercentage;
}
}
This main program is run here:
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner reader = new Scanner(System.in);
System.out.print("Input number of days into Quarter: ");
double days = Integer.parseInt(reader.nextLine());
System.out.println("Input current number of Scripts: ");
double scripts = Integer.parseInt(reader.nextLine());
Drug drug1 = new Drug(scripts, days);
System.out.println(drug1.calcDrug100());
}
}
Even with the user input, I'm printing out 0.0 regardless. I've played with my variables and methods but can't seem to make it work. Any help would be appreciated!