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
Q16: Shadowing is the term used to describe
Q33: Which of the following statements will create
Q34: After the header, the body of the
Q35: In a UML diagram to indicate the
Q38: This refers to the combining of data
Q39: It is common practice in object-oriented programming
Q40: A class's responsibilities include:
A) the things a
Q41: When an object is passed as an
Q41: Look at the following statement. import java.util.Scanner;
This
Q50: The scope of a public instance field
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