This is the first time that I'm going to prepare a book with Latex. I am not so familiar with advanced options of Latex, and in particular with typography. The book includes a lot of examples and problems, but I don't want to write the number of each one because Latex can do it. I have attached a sample page of a book and I want to follow exactly the same style. I will appreciate it if someone helps me. For example, all examples are boxed, and all problems are in a gray box with a thick line at the bottom. The difficult problems are denoted by a star sign. Also, I want to adjust the space of items once for all (I mean, for example, the spacing between the problem and solution), so that I don't have to adjust it each time.

\documentclass[11pt]{book}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{graphicx}
\begin{document}
\title{Quantum Mechanics}
\author{My name}
\maketitle
\chapter{Wave Function}
\section{Schrodinger equation}
I'm going to show the first example
\boxed{
Example 1.1
This is the question. Following is the solution
\textbf{Solution:} And here is the solution
}
\textbf{* Problem 1.1}
Do the followings:
(a) Compute x.
(b) compute y.
\chapter{second}
\chapter{third}
\end{document}

tcolorboxmay be a good choice for such things. It allows you to produce numbered environments that have shaded backgrounds, and much more. Here is a (random) example. – Jan 29 '19 at 22:25