script.js 1.1 KB

123456789101112131415161718192021222324252627282930
  1. const workingHours = 8; // Number of working hours a day
  2. let workingDays = +prompt("Enter working days number ", ""); // Number of working days in a month
  3. while (workingDays == null || workingDays == "" ) {
  4. alert("Working days should be a number");
  5. }
  6. let totalHoursInMonth = workingHours * workingDays;
  7. alert(`Your Total hours this month = ${totalHoursInMonth}`);
  8. let sallary = +prompt("Enter sallary you've got this month ", ""); // Sallary for month
  9. let rate = sallary / totalHoursInMonth; // Rate per hour
  10. alert(`Your rate this month was ${rate}`);
  11. // -----------------------------------------BLUE TASK---------------------------------------
  12. let login = prompt('Enter login', 'default');
  13. if (login == 'admin') {
  14. let password = prompt('Password', 'Enter password');
  15. if (password == 'qwerty') {
  16. alert('Hello Admin', "background: green;");
  17. } else if (password == '' || password == null) {
  18. alert('Wrong password');
  19. } else {
  20. alert('Cancelled');
  21. }
  22. } else if (login == null || login == '') {
  23. alert('Cancelled');
  24. } else {
  25. alert("Login is wrong", "background: red;");
  26. }