7D 1
Part1
Create and load parallel arrays that will hold this data
Create a method that will calculate the total sales for all 5 years
o You can create the method wherever you like
o The method will receive just the sales array (not the year array)
o The method will add up all of the sales
o The method will return the total amount of all sales
o Output the total in the main() with a message “Total sales from XXXX-XXXX”. Use the year array to
Part 2
In the main :
Display ALL years to the user (from the array)
Ask the user to enter a year 2017-2021
1
Search the array for that year
Output the associated annual sales
BIU
▼
A A T
▼
Tx²x₂ = 12pt
742 43
35
D 1
T
Write a Java program to solve the following problem:
A company (Halima Industries) has sales history for the past 5 years.
These are the past 5 years with the annual sales for each year.
2021
$503,000
2020 $813,000
2019 $856,000
2018 $659,000
2017 $525,000
Part1
Create and load parallel arrays that will hold this data
Create a method that will calculate the total sales for all 5 years
o You can create the method wherever you like
o The method will receive just the sales array (not the year array)
o The method will add up all of the sales
o The method will return the total amount of all sales
o Output the total in the main() with a message “Total sales from XXXX-XXXX”. U
Part 2
In the main:
Display ALL years to the user (from the array)
Ask the user to enter a year 2017-2021