Top Posters
Since Sunday
w
5
a
3
j
2
a
2
t
2
u
2
r
2
j
2
j
2
l
2
d
2
y
2
New Topic  
Oughto Oughto
wrote...
Posts: 742
Rep: 1 0
7 years ago
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.println("Final order amount = $" +
                          finalAmount);
   }   
}

A) 522.00
B) 580.00
C) 528.00
D) There is no value because the object order has not been created.
Textbook 
Starting Out with Java: Early Objects

Starting Out with Java: Early Objects


Edition: 4th
Author:
Read 126 times
3 Replies
Replies
Answer verified by a subject expert
ToothyToothy
wrote...
Top Poster
Posts: 744
Rep: 4 0
7 years ago
Sign in or Sign up in seconds to unlock everything for free
More solutions for this book are available here
1

Related Topics

Oughto Author
wrote...
7 years ago
I mentioned in my previous post that I chose this as an elective, thanks for helping me understand
wrote...
7 years ago
Thanks for providing feedback
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1029 People Browsing
Related Images
  
 304
  
 391
  
 385
Your Opinion
What's your favorite math subject?
Votes: 559