didkoslawow

Untitled

Sep 25th, 2022
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. function fuelTank1(input) {
  2.  
  3. let fuelType = input[0];
  4. let fuelLitres = Number(input[1]);
  5.  
  6. switch (fuelType) {
  7. case "Diesel":
  8. if (fuelLitres >= 25) {
  9. console.log("You have enough diesel!");
  10. } else {
  11. console.log("Fill your tank with diesel!");
  12. }
  13. break;
  14. case "Gasoline":
  15. if (fuelLitres >= 25) {
  16. console.log("You have enough gasoline.");
  17. } else {
  18. console.log("Fill your tank with gasoline.");
  19. }
  20. break;
  21. case "Gas":
  22. if (fuelLitres >= 25) {
  23. console.log("You have enough gas.");
  24. } else {
  25. console.log("Fill your tank with gas.");
  26. }
  27. break;
  28. default:
  29. console.log("Invalid fuel!");
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment