{"size": 1352, "ext": "js", "max_stars_repo_path": "04. Methods-Functions/More-Exercises/01. Car Wash.js", "max_stars_repo_name": "tsvdimitrov/SoftUni-JS-Fundamentals", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "04. Methods-Functions/More-Exercises/01. Car Wash.js", "max_issues_repo_name": "tsvdimitrov/SoftUni-JS-Fundamentals", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "04. Methods-Functions/More-Exercises/01. Car Wash.js", "max_forks_repo_name": "tsvdimitrov/SoftUni-JS-Fundamentals", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.1666666667, "max_line_length": 71, "alphanum_fraction": 0.5776627219}
function carWash(inputCommands) {

    let cleaningPercentage = 0;

    for (let i = 0; i < inputCommands.length; i++) {
        detectCommand(inputCommands[i]);
    }
    
    console.log(`The car is ${cleaningPercentage.toFixed(2)}% clean.`);

    function detectCommand(command) {
        switch (command) {
            case "soap":
                cleaningPercentage = soap(cleaningPercentage);
                break;
            case "water":
                cleaningPercentage = water(cleaningPercentage);
                break;
            case "vacuum cleaner":
                cleaningPercentage = vacuumCleaner(cleaningPercentage);
                break;
            case "mud":
                cleaningPercentage = mud(cleaningPercentage);
                break;
        }
    }

    function soap(inputPercentage) {
        inputPercentage += 10;
        return inputPercentage;
    }

    function water(inputPercentage) {
        inputPercentage = 1.2 * inputPercentage;
        return inputPercentage;
    }

    function vacuumCleaner(inputPercentage) {
        inputPercentage = 1.25 * inputPercentage;
        return inputPercentage;
    }

    function mud(inputPercentage) {
        inputPercentage = 0.9 * inputPercentage;
        return inputPercentage;
    }
}
carWash(['soap', 'soap', 'vacuum cleaner', 'mud', 'soap', 'water']);