3. Explain the purpose of class ConvertToCents.
The purpose was to convert the amount of dollars to the equal amount of cents.
5. Place a check to make sure that the cash tendered by the customer is more than the cost of the goods.
if(totalPrice >= amountGiven)
{
System.out.println(“Please insert the correct amount of money.”);
6. In what way does this project exemplify abstraction and modularization.
Abstraction: Changes the dollars to cents.
Modularization: The approach where the application code is subdivided into separate subprograms.
7. Give one example, from this project, of each of the following.
a. an object reference.
b. the use of a primitive type other than int.
“double” in Convert to Cents
c. an object creation.
d. overloading.
e. an internal method call.
f. an external method call.
- Draw an object diagram for one moment in the execution of method getChange() on a Transaction instance that was initialized with..
total price = 5.29
amount of cash = 10.00
You should use the BlueJ debugger to halt the execution at line..
changeInCents = numDollars.getChange();
getChange() ->NumberOfDollars -> changeInCent
No comments:
Post a Comment