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 int getOrderAmount()
{
Return orderAmount;
}
Public int getOrderDisc()
{
Return orderDisc;
}
}
Public class CustomerOrder
{
Public static void main(String[] args)
{
Int ordNum = 1234;
Double ordAmount = 580.00;
Double discountPer = .1;
Order order;
Double finalAmount = order.getOrderAmount() -
Order.getOrderAmount() * order.getOrderDisc() ;
System.out.printf("Final order amount = $%,.2f\n",
FinalAmount) ;
}
}
A) 528.00
B) 580.00
C) There is no value because the constructor has an error.
D) There is no value because the object order has not been created.
Correct Answer:
Verified
Q1: In the cookie cutter metaphor, think of
Q2: Most programming languages that are in use
Q4: Java allows you to create objects of
Q6: For the following code, which statement is
Q7: Which of the following are classes from
Q8: You should not define a class field
Q9: When you are working with a _,
Q10: Class objects normally have _ that perform
Q11: What is stored by a reference variable?
A)
Q54: Which of the following statements will create
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