Exponential growth calculator for COVID-19 I've been listening to some programmers and they use terms like good and bad code. I am not really sure what they mean by that. I mean I went on r/badcode and saw some stuff I knew was definitely bad code. But I don't really understand if bad code is repeatedly typing the same code instead of looping or just bad layouts.
    import java.io.IOException;
    import java.util.Scanner;
    class Covid19ExpoGrowth {
    public static void main(String[] args) throws IOException {
    // I will use the formula y = a(1 + r)^x
    // a = initial value
    // r = growth rate
    // x = time interval
    int a;
    double r;
    int x;

    // Workout exponential growth
    System.out.println(&quot;Let us see the Exponential growth of Covid-19.&quot;);
    System.in.read();
    System.out.println(&quot;We will set the initial value of Covid as 88,000 as that was the amount of cases in february&quot;);
    a = 88000;
    System.in.read();

    System.out.println(&quot;We need to find the growth rate of Covid-19, we can use the growthRate method&quot;);
    System.in.read();
    r = growthRate(14000, 88000);
    r = Math.round(r * 10.0) / 10;
    System.out.println(&quot;Using the growthRate method, we worked out the growth rate is: &quot; + r + &quot; rounded to no d.p&quot;);
    System.in.read();

    System.out.println(&quot;The time interval will be from February 01 2020 - April 16 2020, 45 days&quot;);
    x = 45;
    System.in.read();

    System.out.println(&quot;Now we have all the values let us use the method calculateExpoGrowth&quot;);
    System.in.read();
    double roundedExpo;
    roundedExpo = Math.round(calculateExpoGrowth(a, r, x) * 100) /10;
    System.out.println(&quot;The Exponential growth of Covid 19 is: &quot; + roundedExpo + &quot; rounded to 2 d.p&quot;);

    System.out.println(&quot;You can now work out your own Exponential Growth&quot;);

    // User works out chosen exponential growth
    while (true) {
        System.out.println(&quot;Please enter the initial value&quot;);
        Scanner scan = new Scanner(System.in);
        a = scan.nextInt();

        Scanner scan_gr = new Scanner(System.in);System.out.println(&quot;Enter WORKOUT GROWTH RATE if you would like to workout the growth rate,&quot; +
                &quot;if you already know it press enter&quot;);
        String gr = scan_gr.nextLine();
        if (gr.equals(&quot;WORKOUT GROWTH RATE&quot;)) {
            int pastValue;
            int presentValue;

            System.out.println(&quot;Please enter the past value&quot;);
            pastValue = scan.nextInt();

            System.out.println(&quot;Please enter the present value&quot;);
            presentValue = scan.nextInt();

            r = growthRate(pastValue, presentValue);
        } else {
            System.out.println(&quot;Please type in the growth rate&quot;);
            r = scan.nextDouble();
        }
        System.out.println(&quot;Now finally, type in the time interval&quot;);
        x = scan.nextInt();
        double roundedExpo2;

        roundedExpo2 = Math.round(calculateExpoGrowth(a, r, x) * 100) / 10;

        System.out.println(&quot;The program has calculated the Exponential growth is: &quot; + roundedExpo2 + &quot; rounded to 2 d.p&quot;);
    }
}
public static double growthRate(int pastVal, int presentVal){
    // To work out growth rate you:

    double newVal = presentVal - pastVal;
    // Subtract the past value from the present value

    return newVal / pastVal;
    // Divide the new value by the past value

}
public static double calculateExpoGrowth(int a, double r, int x){
    // Exponential growth formula
    return (a * Math.pow((1 + r), x));

}
}
Your formula was assuming 14,000 cases a day, rather than 14,000 cases a month.  I removed all rounding, choosing to round for display only.

Here's a partial result of the last test run I did.  I formatted the output manually to fit in the answer.

Let us see the Exponential growth of Covid-19.
We will set the initial value of Covid as 
88,000 as that was the amount of cases in 
February.

We need to find the growth rate of Covid-19, 
we can use the growthRate method.
We'll assume a linear growth rate of 14,000 
cases a month.

Using the growthRate method, we worked out 
the growth rate is 0.005303.

The time interval will be from February 1, 
2020 - April 16, 2020, 45 days.
Now we have all the values let us use the 
method calculateExpoGrowth

The Exponential growth of Covid 19 is 
111,647 cases by April 16, 2020.


I cleaned up the code a lot.  Here it is.

import java.io.IOException;
import java.text.DecimalFormat;
import java.util.Scanner;

public class Covid19ExpoGrowth {
    public static void main(String[] args) {
        try {
            calculateGrowth();
        } catch (IOException e) {
            e.printStackTrace();
        }

        System.out.println();
        System.out.println("You can now work out your "
                + "own Exponential Growth");

        // User works out chosen exponential growth
        Scanner scan = new Scanner(System.in);
        while (getUserInput(scan));
        scan.close();
    }

    private static void calculateGrowth() throws IOException {
        // I will use the formula y = a(1 + r)^x
        // a = initial value
        // r = growth rate
        // x = time interval
        int a;
        double r;
        int x;

        // Workout exponential growth
        System.out.println("Let us see the Exponential "
                + "growth of Covid-19.");
        System.out.println(
                "We will set the initial value of Covid "
                + "as 88,000 as that was the amount of "
                + "cases in February.");
        System.out.println();
        a = 88_000;
        System.out.println("We need to find the growth "
                + "rate of Covid-19, we can use the "
                + "growthRate method.");
        System.out.println("We'll assume a linear growth rate "
                + "of 14,000 cases a month.");
        System.out.println();
        r = growthRate(a, 14_000d + a) / 30d;
        String output = String.format("%.6f", r);
        System.out.println("Using the growthRate method, "
                        + "we worked out the growth "
                        + "rate is: " + output + ".");
        System.out.println();
        System.out.println("The time interval will be "
                + "from February 1, 2020 - April 16, 2020,"
                + " 45 days.");
        x = 45;
        System.out.println("Now we have all the values "
                + "let us use the method calculateExpoGrowth");
        System.out.println();
        double roundedExpo = calculateExpoGrowth(a, r, x);
        DecimalFormat formatter = new DecimalFormat(
                "###,###,###");
        output = formatter.format(roundedExpo);
        System.out.println("The Exponential growth of "
                + "Covid 19 is " + output 
                + " cases by April 16, 2020.");
    }

    private static boolean getUserInput(Scanner scan) {
        int a;
        double r;
        int x;

        System.out.println("Please enter the initial value");
        String value = scan.nextLine().trim();
        if (value.isEmpty()) {
            return false;
        }

        a = Integer.valueOf(value);

        System.out.println("Enter WORKOUT GROWTH RATE if you "
                + "would like to workout the growth rate,"
                + "if you already know it press enter");
        String gr = scan.nextLine().trim();
        if (gr.equalsIgnoreCase("WORKOUT GROWTH RATE")) {
            int pastValue;
            int presentValue;

            System.out.println("Please enter the past value");
            pastValue = Integer.valueOf(scan.nextLine().trim());

            System.out.println("Please enter the present value");
            presentValue = Integer.valueOf(scan.nextLine().trim());

            System.out.println("Please enter the days");
            int days = Integer.valueOf(scan.nextLine().trim());

            r = growthRate(pastValue, presentValue) / days;
        } else {
            System.out.println("Please type in the growth rate");
            r = Double.valueOf(scan.nextLine().trim());
        }
        System.out.println("Now finally, type in the time "
                + "interval");
        x = Integer.valueOf(scan.nextLine().trim());
        double roundedExpo2 = calculateExpoGrowth(a, r, x);
        DecimalFormat formatter = new DecimalFormat(
                "###,###,###");
        String output = formatter.format(roundedExpo2);
        System.out.println(
                "The program has calculated the Exponential "
                + "growth is: " + output + ".");
        return true;
    }

    public static double growthRate(double pastVal, 
            double presentVal) {
        double newVal = presentVal - pastVal;
        return newVal / pastVal;
    }

    public static double calculateExpoGrowth(int a, double r, 
            int x) {
        // Exponential growth formula
        return (a * Math.pow((1d + r), (double) x));
    }
}