What is the output of the following code snippet?

int golfScore = 64;
if (golfScore < 60)
{
System.out.println("Astounding!");
}
if (golfScore >= 60 && golfScore < 70)
{
System.out.println("Professional!");
}
if (golfScore >= 70 && golfScore < 80)
{
System.out.println("Pretty good!");
}
if (golfScore >= 80 && golfScore < 90)
{
System.out.println("Not so hot!");
}
if (golfScore >= 90)
{
System.out.println("Keep your day job!");


}
Astounding!

Professional!

Pretty good!

Keep your day job!

Respuesta :

Answer:

The output of the following code snippet is Professional

Explanation:

Depending on the golfScore, the program outputs something.

If it is lesser than 60, the output is Astouding

If it is between 60 and 69, the output is Professional

If it is between 70 and 79, the output is Pretty good

If it is between 80 and 89, the output is Not so Hot

If it is 90 or higher, the output is Keep your day job.

In this program, the variable golfScore is initialized as 64. This is between 60 and 69, so the output is Professional.