subject

Create a JAVA PROGRAMCreate a class called PurchaseTotal in the com. day2.practice3 package. That class will have the following class variables: saleId (int), itemName (String), itemPrice (double), itemsSold (int), date (String … store the date in as a String in mm/dd/ format).An example of creating a new PurchaseTotal object: PurchaseTotal total1 = new PurchaseTotal(1, "5-lb bag of apples", 4.00, 25, "10/01/2019");This would be a record stating that the store sold twenty-five 5-lb bags of apples for $4.00 each on October 1st, 2019. Create a class called PurchaseTotalDemo in the com. day2.practice3 package with a main method. In the main, create an array containing 6 PurchaseTotal records. Have three records contain apples sold for 10/01/2019, 10/02/2019, and 10/03/2019. Have the itemsSold contain different values. The other three records will be for a different item sold during those three dates. Create a new method in the PurchaseTotalDemo called calculateInventory which passes in an array of PurchaseTotal records, the name of the item to search for (String), and the initial inventory count (int). The search should not be case-sensitive. The method will return an int of the remaining inventory count for that item. The method will calculate the remaining inventory by adding up all of the items sold for all matching items. This total will be subtracted from the initial inventory, resulting in a number that is the remaining inventory. This count of the remaining inventory will be returned. Example: Let’s say on 10/01/2019, you sold 25 watermelons and on 10/02/2019, you sold 20 and on 10/03/2019, you sold 30 watermelons. If you called the getTotalSales method, passing in the PurchaseTotal array, the String "Watermelon", and an initialInventory of 100, the method will total up all of the watermelons sold (25+20+30 = 75) and then subtract that total from the initial inventory of 100 (100 initial watermelons – 75 watermelons sold = 25 remaining watermelons). So, the method will return how many watermelons remain: 25.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:30
In deadlock avoidance using banker’s algorithm, what would be the consequence(s) of: (i) a process declaring its maximum need as maximum possible for each resource. in other words, if a resource a has 5 instances, then each process declares its maximum need as 5. (ii) a process declaring its minimum needs as maximum needs. for example, a process may need 2-5 instances of resource a. but it declares its maximum need as 2.
Answers: 3
question
Computers and Technology, 23.06.2019 10:50
Your friend kayla is starting her own business and asks you whether she should set it up as a p2p network or as a client-server network. list three questions you might ask to kayla decide which network to use and how her answers to those questions would affect your recommendation.
Answers: 2
question
Computers and Technology, 23.06.2019 21:00
Will this setup result in what kathy wants to print?
Answers: 2
question
Computers and Technology, 24.06.2019 05:00
Who is most likely be your target audience if you create a slide presentation that had yellow background and purple text
Answers: 2
You know the right answer?
Create a JAVA PROGRAMCreate a class called PurchaseTotal in the com. day2.practice3 package. That cl...
Questions
Questions on the website: 13722363