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, 21.06.2019 23:30
4.11 painting a wall (1) prompt the user to input integers for a wall's height and width. calculate and output the wall's area (integer). note that in this case there is a new line after each prompt. (submit for 1 point). enter wall height (feet): 11 enter wall width (feet): 15 wall area: 165 square feet (2) extend to also calculate and output the amount of paint in gallons needed to paint the wall (floating point). assume a gallon of paint covers 350 square feet. store this value in a variable. output the amount of paint needed using the %f conversion specifier. (submit for 2 points, so 3 points total). enter wall height (feet): 11 enter wall width (feet): 15 wall area: 165 square feet paint needed: 0.471429 gallons (3) extend to also calculate and output the number of 1 gallon cans needed to paint the wall. hint: use a math function to round up to the nearest gallon. (submit for 2 points, so 5 points total). enter wall height (feet): 11 enter wall width (feet): 15 wall area: 165 square feet paint needed: 0.471429 gallons
Answers: 3
question
Computers and Technology, 22.06.2019 12:30
An atom's diameter is about 0.1 nanometer (1×10-9m), and a human hair is about 1×10-3m. how many times greater is a human hair than an atom's diameter? sorry pushed wronf button but this is math
Answers: 3
question
Computers and Technology, 23.06.2019 01:00
Complete the sentence about a presentation delivery method
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Choose the answers that best complete each sentence. on average,are more expensive than other kinds of postsecondary schools. the cost of room and board includes. to save money, some students attend auniversity in their home state.
Answers: 2
You know the right answer?
Create a JAVA PROGRAMCreate a class called PurchaseTotal in the com. day2.practice3 package. That cl...
Questions
question
English, 04.04.2021 18:00
question
Social Studies, 04.04.2021 18:00
question
Mathematics, 04.04.2021 18:00
Questions on the website: 13722363