Solved

Assuming That a User Enters 22 as the Price of an Item

Question 68

Multiple Choice

Assuming that a user enters 22 as the price of an item, which of the following hand trace tables is valid for the code below?
Public static void main(String[] args)
{
Int price = 0;
Scanner in = new Scanner(System.in) ;
System.out.print("Please enter object's price: ") ;
Price = in.nextInt() ;
System.out.println("Object price is " + getStatus(price) ) ;
}
Public static String getStatus(int price)
{
String status = "";
If (price >= 50)
{
Status = "reasonable";
If (price >= 75)
{
Status = "costly";
}
}
Else
{
Status = "inexpensive";
If (price <= 25)
{
Status = "reasonable";
}
}
Return status;
}


A) Assuming that a user enters 22 as the price of an item, which of the following hand trace tables is valid for the code below? Public static void main(String[] args)  { Int price = 0; Scanner in = new Scanner(System.in) ; System.out.print( Please enter object's price:  ) ; Price = in.nextInt() ; System.out.println( Object price is   + getStatus(price) ) ; } Public static String getStatus(int price)  { String status =   ; If (price >= 50)  { Status =  reasonable ; If (price >= 75)  { Status =  costly ; } } Else { Status =  inexpensive ; If (price <= 25)  { Status =  reasonable ; } } Return status; } A)    B)    C)    D)
B) Assuming that a user enters 22 as the price of an item, which of the following hand trace tables is valid for the code below? Public static void main(String[] args)  { Int price = 0; Scanner in = new Scanner(System.in) ; System.out.print( Please enter object's price:  ) ; Price = in.nextInt() ; System.out.println( Object price is   + getStatus(price) ) ; } Public static String getStatus(int price)  { String status =   ; If (price >= 50)  { Status =  reasonable ; If (price >= 75)  { Status =  costly ; } } Else { Status =  inexpensive ; If (price <= 25)  { Status =  reasonable ; } } Return status; } A)    B)    C)    D)
C) Assuming that a user enters 22 as the price of an item, which of the following hand trace tables is valid for the code below? Public static void main(String[] args)  { Int price = 0; Scanner in = new Scanner(System.in) ; System.out.print( Please enter object's price:  ) ; Price = in.nextInt() ; System.out.println( Object price is   + getStatus(price) ) ; } Public static String getStatus(int price)  { String status =   ; If (price >= 50)  { Status =  reasonable ; If (price >= 75)  { Status =  costly ; } } Else { Status =  inexpensive ; If (price <= 25)  { Status =  reasonable ; } } Return status; } A)    B)    C)    D)
D) Assuming that a user enters 22 as the price of an item, which of the following hand trace tables is valid for the code below? Public static void main(String[] args)  { Int price = 0; Scanner in = new Scanner(System.in) ; System.out.print( Please enter object's price:  ) ; Price = in.nextInt() ; System.out.println( Object price is   + getStatus(price) ) ; } Public static String getStatus(int price)  { String status =   ; If (price >= 50)  { Status =  reasonable ; If (price >= 75)  { Status =  costly ; } } Else { Status =  inexpensive ; If (price <= 25)  { Status =  reasonable ; } } Return status; } 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