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, 22.06.2019 15:30
Melissa needs to add a topic to an email that she will send to her teacher. choose the name of the field where she should type her topic.
Answers: 2
question
Computers and Technology, 22.06.2019 18:10
How can i delete permalinks from a word press site?
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
You are new to microsoft certification and want to start out by getting a certification geared around windows 8. what microsoft certification should you pursue?
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Visually impaired individuals generally rely on the for navigation. thus, designers need to ensure that mouse-specific inputs, such as pointing, clicking, and hovering, can be done without a mouse.
Answers: 1
You know the right answer?
Create a JAVA PROGRAMCreate a class called PurchaseTotal in the com. day2.practice3 package. That cl...
Questions
question
Chemistry, 24.04.2020 23:26
question
History, 24.04.2020 23:26