Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ code Outline: In this project, you are expected to write a program that calculates and keeps the tiredness of a rectangular field as a

C++ code
image text in transcribed
image text in transcribed
Outline: In this project, you are expected to 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 program will read the name of the file as a string which holds the planting input. The file will contain the following information: First the horizontal size of the rectangular field (sizeX) and the vertical size of the rectangular field (sizeY) will be given as int values. Then, 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, end XCoord, and end Y Coord representing this smaller rectangular area has been planted in this year. This current Year - plantingCount and that many plantingCount information blocks will keep continuing for cach subsequent year until the current Year's value becomes 2017 which will be the last information block Example input file 108 2015 2 0055 7082 2016 1 0055 20172 0033 7082 . . Each information will be given IN A SINGLE LINE within the file as seen in the example above. Using this information, your program will calculate the tiredness of cach part of the 2D rectangular field as follows: Each cell in the 2D int array will represent the tiredness of that part of the field. The tiredness of each part starts at "0" The tiredness of each part increases by I every year the field has been planted, The tiredness of each part decreases by I every year the field has NOT been planted to a minimum of o. Ecomunale output tiredness man for the input ght above 3 3 3 1 1 1 1 . . 3 0 0 3 3 3 3 1 1 0 1 1 0 3 3 3 3 1 1 0 1 1 0 3 3 3 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Input: . . The horizontal size of the field The vertical size of the field Yearly infomation block: o Starting with year information and number of plantings in that year 0 Then the top left and bottom right coordinates of each planting in that year Output: . The tiredness map of the whole field as a 2D int array NOTE: The coordinates of the top left corner part of the map is 0,0 and the maximum size of the field is 40,40 NOTE: No plantings given for the same year can overlap with one another. NOTE: You MUST use relative address for the input file and put the file in the folder where your executable is. HINT: You should start with a 2D array where the value of EACH cell is 0 HINT: While calculating the map for the next year, using a temporary second 2D array is STRONGLY SUGGESTED (e.g., tirednessMap, new TirednessMap). Sample Input/Outputs: Input Output fieldinfo L.txt 00011 02210 02210 02220 00000 fieldInfo2.txt File Contents (filename should be the same as in the input) 55 2016 2 0022 1344 2017 2 1133 3040 10 10 20143 2227 3487 8193 20153 2227 5487 8193 20164 0022 3869 5485 8193 2017 2 8193 9899 55 20141 0022 20151 0022 2016 0 20170 0000000000 0000000044 0020000044 0000000044 0000022220 0000022220 0000000000 0000000000 0000000001 0000000001 fieldInfo3.txt 00000 00000 00000 00000 00000

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

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago