Solved

Assuming That a User Enters 45 as the Brightness of a Lamp

Question 87

Multiple Choice

Assuming that a user enters 45 as the brightness of a lamp, which of the following hand-trace tables is valid for the given code snippet?
Int brightness = 0;
String description = "";
Scanner in = new Scanner(System.in) ;
System.out.print("Enter your lamp brightness (in watts) : ") ;
Brightness = in.nextInt() ;
If (brightness >= 120)
{
Description = "very bright";
If (brightness >= 100)
{
Description = "bright";
}
}
Else
{
Description = "pleasant";
If (brightness <= 50)
{
Description = "dim";
}
}


A) Assuming that a user enters 45 as the brightness of a lamp, which of the following hand-trace tables is valid for the given code snippet? Int brightness = 0; String description =   ; Scanner in = new Scanner(System.in) ; System.out.print( Enter your lamp brightness (in watts) :  ) ; Brightness = in.nextInt() ; If (brightness >= 120)  { Description =  very bright ; If (brightness >= 100)  { Description =  bright ; } } Else { Description =  pleasant ; If (brightness <= 50)  { Description =  dim ; } } A)    B)    C)    D)
B) Assuming that a user enters 45 as the brightness of a lamp, which of the following hand-trace tables is valid for the given code snippet? Int brightness = 0; String description =   ; Scanner in = new Scanner(System.in) ; System.out.print( Enter your lamp brightness (in watts) :  ) ; Brightness = in.nextInt() ; If (brightness >= 120)  { Description =  very bright ; If (brightness >= 100)  { Description =  bright ; } } Else { Description =  pleasant ; If (brightness <= 50)  { Description =  dim ; } } A)    B)    C)    D)
C) Assuming that a user enters 45 as the brightness of a lamp, which of the following hand-trace tables is valid for the given code snippet? Int brightness = 0; String description =   ; Scanner in = new Scanner(System.in) ; System.out.print( Enter your lamp brightness (in watts) :  ) ; Brightness = in.nextInt() ; If (brightness >= 120)  { Description =  very bright ; If (brightness >= 100)  { Description =  bright ; } } Else { Description =  pleasant ; If (brightness <= 50)  { Description =  dim ; } } A)    B)    C)    D)
D) Assuming that a user enters 45 as the brightness of a lamp, which of the following hand-trace tables is valid for the given code snippet? Int brightness = 0; String description =   ; Scanner in = new Scanner(System.in) ; System.out.print( Enter your lamp brightness (in watts) :  ) ; Brightness = in.nextInt() ; If (brightness >= 120)  { Description =  very bright ; If (brightness >= 100)  { Description =  bright ; } } Else { Description =  pleasant ; If (brightness <= 50)  { Description =  dim ; } } A)    B)    C)    D)

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents