Code Help

Discussion in 'Programming' started by ArZor, Apr 5, 2018.

  1. Choco

    Moderator

    A few things of note:
    1. "Public" is capitalized in the class declaration. It should not be.
    2. A lot of the code in #calculateSalesTax() is just fluff. Can be condensed down a lot
    Code (Java):
    public static double calculateSalesTax(double tax, double cost) {
        return cost * (tax / 100.0);
    }
    3. When initializing the Scanner object (i.e. "new Scanner(system.in)"), "system" is lowercased when it should be uppercase. i.e. "system" -> "System"
    4. The method #SalesTaxCalculations() does not exist when it's called in the main method. It should match the name of the method above, #calculateSalesTax(). Perhaps they just missed a method rename
    5. There are some missing imports for DecimalFormat, although this could just be snipped out of the screenshot. Worth noting regardless

    Be sure your friend is writing in a proper Java IDE such as Eclipse, IntelliJ or NetBeans :) Also, in the future, we do have a Programming forum which you're more than welcome to post programming-related questions / content in ^-^
     
  2. Tyvm yeah I thought that was just for Mine craft :p