Question: java thank you! 2 separate files thanks!!: 1.AmazonOrder.java 2.AmazonOrderPrinter.java (provided) Use the following file: AmazonOrderPrinter.java /** * Tester for the AmazonOrderPrinter class * * @author
java thank you!
2 separate files thanks!!:
1.AmazonOrder.java
2.AmazonOrderPrinter.java (provided)

Use the following file:
AmazonOrderPrinter.java
/** * Tester for the AmazonOrderPrinter class * * @author Kathleen O'Brien */ public class AmazonOrderPrinter { public static void main(String[] args) { AmazonOrder order = new AmazonOrder(); order.add(12.59); order.add(18.25); order.remove(12.59); System.out.println(" Contents"); System.out.println(order.getContents()); order.reset(); order.add(10.25); order.add(11.75); order.add(15.50); order.remove(15.50); order.add(23); System.out.println("Subtotal: " + order.getSubtotal()); System.out.println("Total: " + order.getTotal()); System.out.println(" Contents"); System.out.println(order.getContents()); System.out.println(" Contents"); System.out.println(order.getContents()); } }
Write a class Amazonorder which keeps track of the items a person orders on Amazon. We want to be able to add an item of a specific cost and remove an item of a specific cost. We also want to able able to get the subtotal, total and a string representation of the contents of the Amazonorder Amazonorder has a no agument constructor which initializes the instance variables (subtotal to o, contents to the empty string) It has the following methods: eAmaz publia void add (double oost) adds this cost to the subtotal for this AmazonOrder and records the item added in the contents (see below) ost) subtracts this cost from the subtotal for this AmazonOrder and records the item removed in the contents see below) gets the subtotal for this Amazonorder publio void remove double . publio double getSubtotal * getTota1() Gets the total which is the subtotal plus tax. The tax is 8.5%. Define 8.5 as a constant in the method. (not as an instance variable . getcontents returns the string representation of the cost of the ites added to and removed trom in the order and the total cost. Be sure to call getTotal. Do not cakulate the total i this rmethod. .reaet returrns thhe object to its uriginal state were no iteris are intherd The stg repreening the iterris in the oder wil be et to the empty striny and the sublolal will be set to 0 l o add to the arder: add the string Aod itemor Remove item, a colon, a space, and then the value of the transaction and a newdine I he farmat of the string returned hy gatcontent:a Add Iltem: 2.59 Add Item:8.2 Remove Item Total: 8.95125 2.59 The total is displayed at the end. NOTE: I should get the same output if I call getContents0 twice in a row. You need to provide a Javadoc comment for your all methods, the constructor and the class itself
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
