Retail Transaction Programming Project

IT Infrastructure Policies
January 23, 2023
NEED 2+ PAGES WITH 3 PEER REVIEWED REFERENCES CITED IN APA FORMAT- NO PLAGIARISM
January 23, 2023

Retail Transaction Programming Project

You will then create a new project in NetBeans to implement Programming Project 1.Retail Transaction Programming ProjectProject Requirements:1. Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. TheLineItem class will represent an individual line item of merchandise that acustomer is purchasing. The Transaction class will combine several LineItemobjects and calculate an overall total price for the line item within the transaction.There will also be two test classes, one for the LineItem class and one for theTransaction class.2. Design and build a LineItem class. This class will have three instance variables.There will be an itemName variable that will hold the identification of the line item(such as, “Colgate Toothpaste”); a quantity variable that will hold the quantity ofthe item being purchased; and a price variable that will hold the retail price of theitem. The LineItem class should have a constructor, accessors for the instancevariables, a method to compute the total price for the line item, a method toupdate the quantity, and a method to convert the state of the object to a string.Using Unified Modeling Language (UML), the class diagram looks like this:LineItem- itemName : String- quantity : int- price : double+ LineItem( String, int, double )+ getName( ) : String+ getQuantity( ) : int+ getPrice( ) : double+ getTotalPrice( ) : double+ setQuantity( int )+ setPrice( double )+ toString( ) : Stringa. The constructor will assign the first parameter to the instance variableitemName, the second parameter to the instance variable quantity, andthe third parameter to the instance variable price.b. The class will have three accessor methods—getName( ), getQuantity( ),and getPrice( )—that will return the value of each respective instancevariable. © 2014 Laureate Education, Inc. Page 2 of 4c. The class will have two mutator methods, setQuantity( int ) and setPrice(double ), that will update the quantity and price, respectively, of the itemassociated with the line of the transaction.d. The method getTotalPrice( ) handles the conversion of the quantity andprice into a total price for the line item.e. The method toString( ) allows access to the state of the object in aprintable or readable form. It converts the variables to a single string thatis neatly formatted.Note: Refer to the textbook for a discussion of escape sequences. Theseare characters that can be inserted into strings and, when printed, willformat the display neatly. An escape sequence for the tab character canbe inserted to get a tabular form when printing. This tab character is “t”.The LineItem class will have a toString( ) method that concatenatesitemName, quantity, price, and total price—separated by tabcharacters—and returns this new string. When printing an object, thetoString( ) method will be implicitly called, which in this case, will print astring that will look something like:Colgate Toothpaste qty 2 @ $2.99 $5.983. Build a Transaction class that will store information about the items beingpurchased in a single transaction. It should include a customerID andcustomerName. It should also include an ArrayList to hold information abouteach item that the customer is purchasing as part of the transaction.Note: You must use an ArrayList, not an array.4. Build a TransactionTest class to test the application. The test class should notrequire any interaction with the user. It should verify the correct operation of theconstructor and all methods in the Transaction class.Specific Requirements for the Transaction Class1. The Transaction class should have a constructor with two parameters. The firstis an integer containing the customer’s ID and the second is a String containingthe customer’s name.2. There should be a method to allow the addition of a line item to the transcript.The three parameters for the addLineItem method will be (1) the item name, (2)the quantity, and (3) the single item price.3. There should be a method to allow the updating of a line item already in thetransaction. Notice that updating an item means changing the quantity or price(or both). The parameters for the updateItem method are also (1) the item name,(2) the quantity, and (3) the single item price. Notice that the updating of a © 2014 Laureate Education, Inc. Page 3 of 4specific line item requires a search through the ArrayList to find the desireditem. Anytime a search is done, the possibility exists that the search will beunsuccessful. It is often difficult to decide what action should be taken when suchan “exception” occurs. Since exception handling is not covered until later in thistextbook, make some arbitrary decisions for this project. If the item to be updatedis not found, take the simplest action possible and do nothing. Do not print anerror message to the screen. Simply leave the transaction unchanged.4. The transaction class needs a method called getTotalPrice to return the totalprice of the transaction.5. There should also be a method to return information about a specific line item. Itshould return a single String object in the same format described for theLineItem class:Colgate Toothpaste qty 2 @ $2.99 $5.98Again, the possibility exists that the search for a specific line item will fail. In thisinstance, you should return a string containing a message similar to this:Colgate Toothpaste not found.6. The final method needed is a toString method. It should return the transactioninformation in a single String object. It should use the following format:Customer ID : 12345Customer Name : John DoeColgate Toothpaste qty 2 @ $2.99 $5.98Bounty Paper Towels qty 1 @ $1.49 $1.49Kleenex Tissue qty 1 @ $2.49 $2.49Transaction Total $9.96Notice that a newline character “n” can be inserted into the middle of a string.Ex.int age = 30;String temp = “John Doe n is ” + age + “n” + ” yearsold”;The output would be:John Doeis 30years old© 2014 Laureate Education, Inc. Page 4 of 4Notice also that “n” is a single character and could actually go inside single ordouble quotes, depending on the circumstances.Here is a UML diagram for the Transaction class as described above. Notice thatprivate instance variables and methods may be added, as needed. For all publicmethods use exactly the name given below.Transaction- lineItems : ArrayList- customerID : int- customerName : String+ Transaction( int, String )+ addLineItem( String, int, double )+ updateItem( String, int, double )+ getTotalPrice( ) : double+ getLineItem( String ) : String+ toString( ) : StringAttached is a copy of the project requirements

 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.