Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago