Given the following code, what will be the value of finalAmount when it is displayed?
public class Order
{
Private int orderNum;
Private double orderAmount;
Private double orderDiscount;
Public Order(int orderNumber, double orderAmt,
Double orderDisc)
{
OrderNum = orderNumber;
OrderAmount = orderAmt;
OrderDiscount = orderDisc;
}
Public double finalOrderTotal()
{
Return orderAmount - orderAmount * orderDiscount;
}
}
Public class CustomerOrder
{
Public static void main(String[ ] args)
{
Order order;
Int orderNumber = 1234;
Double orderAmt = 580.00;
Double orderDisc = .1;
Order = new Order(orderNumber, orderAmt, orderDisc) ;
Double finalAmount = order.finalOrderTotal() ;
System.out.printf("Final order amount = $%,.2f\n",
FinalAmount) ;
}
}
A) 528.00
B) 580.00
C) 522.00
D) There is no value because the object, order, has not been created.
Correct Answer:
Verified
Q48: A constructor _.
A) always accepts two arguments
B)
Q49: A(n) _ can be thought of as
Q50: The scope of a public instance field
Q51: Instance methods do not have the _
Q52: Java allows you to create objects of
Q53: A reference variable stores a(n) _.
A) binary
Q54: Which of the following statements will create
Q55: Given the following code, what will be
Q57: Two or more methods in a class
Q58: Methods that operate on an object's fields
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents