you would have to alter the sudoers file (or add a new file to /etc/sudoers.d/) to allow user "user" to execute this script without password:
user ALL=(ALL:ALL) NOPASSWD: /home/user/Desktop/script.sh
if you do not want to execute the whole script.sh as root, you need to mention all commands within the script.sh that you will be prepending with sudo. it's somehow more readable if you use the alias feature:
Cmnd_Alias SCRIPT_CMDS = /sbin/poweroff, /sbin/reboot, /sbin/halt
user ALL=(ALL:ALL) NOPASSWD: SCRIPT_CMDS
EDIT
If you build some script that outputs the password at stdout, you can use the askpass parameter:
sudo -A /path/to/password-output-script /some/command/to/be/run/as/root
else this might be of interest to you (from sudo man page):
-S, --stdin
Write the prompt to the standard error and read the password from the standard input instead of using the terminal device.
The password must be followed by a newline character.