Question: Assignment Write a program that calculates and keeps the tiredness of a rectangular field as a 2D int array (tirednessMap) given the information about which

 Assignment Write a program that calculates and keeps the tiredness of

Assignment Write a program that calculates and keeps the tiredness of a rectangular field as a 2D int array (tirednessMap) given the information about which parts of the field has been planted in the previous years. The current year is 2020. The size of the field will ALWAYS be 8x8. First, a planting information will be given for each previous year as an information block. The information block will start with the year information (currentYear) and how many plantings have been made during that year (planting Count), both as int values. Next, plantingCount many planting information will be given as 4 int tuples: startxCoord, startyCoord, endxCoord, and endyCoord representing this smaller rectangular area has been planted in this year. This currentYear - plantingCount and that many plantingCount information blocks will keep continuing for each subsequent year until the currentYear's value becomes 2019 which will be the last information block Using this information, your program will calculate the tiredness of each part of the 2D rectangular field as follows and prints it out at the end: Each cell in the 2D int array will represent the tiredness of that part of the field. The tiredness of each part starts at "O". The tiredness of each part increases by 1 every year the field has been planted. The tiredness of each unplanted part decreases by 1 every year to a minimum of o. NOTE: The coordinates of the top left corner part of the map is 0,0. NOTE: No plantings given for the same year can overlap with one another. HINT: You should start with a 2D array of size 8x8 where the value of EACH cell is O. 20161 0022 2018 2 0022 1344 2017 2 0055 7072 2018 1 0055 20171 0022 Input 2019 2 1133 3040 2018 0 2019 2 0033 7072 20190 Output 0001100000000000 02210000 0000 0000 0221000000000000 022 2000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 333 31101 33331101 33331101 333 31100 11111100 11111100 00000000 00000000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!