Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Contamination Checker General Submit all files to elearn. Make sure to name file ( s ) EXACTLY as specified - including capitalization. Do not zip
Contamination Checker
General
Submit all files to elearn. Make sure to name files EXACTLY as specified including capitalization. Do not zip or otherwise packagecompress files unless told to
Make sure your program accepts input in EXACTLY the order and format given. Do not ask for extra input or change the order of inputs.
If you want to make an expanded version of a program that and get feedback on it email it to me or show me in class.
Slight variations in output wordingformatting are usually fine as long as formatting isn't part of the assignment
If you do not get the right final output, print out some evidence of the work your program did to demonstrate your progress.
Readability and maintainability of your code counts. Poor formatting, confusing variable names, unnecessarily complex code, etc... will all result in deductions to your score.
Assignment Instructions
main.cpp
This is an "old school" assignment where all your code will be in one file. I should be able to do this to build your code:
gg stdc main.cpp o program.exe
Problem Details
A containment wall has been built around a leaking radioactive storage tank. Unfortunately, the wall may not have been built correctly. Anywhere two wall blocks meet at a corner, radioactive gas can seep through and contaminate the area beyond. We need to know if the leak is contained and if so how badly contaminated the area is A leak that reaches any border square is considered to be uncontained.
Your task is to read in the locations of the radioactive container and of all the walls each will be represented by an row col pair You then should print the final map after the contamination has spread. If the situation is safe radiation did not reach the border of the map print out "Safe" and how many square units are contaminated. If the radiation is not contained, print out "Not Safe".
You can assume that we will always be operating on a x grid like the ones shown below.
Radiation leaks
The input for the start location will always come first as row col, followed by the locations of the walls, given as a series of numbers separated by spaces: row col row col The list of walls will always end with with do not place a wall there, that is just a signal that the input is done.
You can and should use a loop to get the inputs and to print the board. The "contamination", count of the affected squares, and "safe" determination should be done recursively. No loops
You must use parameters to pass information from one recursive call to another. No global variables allowed constants are OK You may not make a class that contains your functions.
A solution for the contamination and count that does not use recursion will NOT receive points.
Sample Runs
While testing your code, you should just copy and paste the long input sequence into the terminal. Right click in terminal window to paste
Run
Sample Input Output: User input in red
Enter contaminated location row col:
Enter wall locations row col followed by to indicate end of input:
# # # # #
# #
# # #
# # #
# #
Not Safe
Run
Sample Input Output: User input in red
Enter contaminated location row col:
Enter wall locations row col followed by to indicate end of input:
# # #
# # # # #
# # #
# # # # #
Safe!
Contaminated area:
Run
Sample Input Output: User input in red
Enter contaminated location row col:
Enter wall locations row col followed by to indicate end of input:
# #
# #
# # #
Not Safe
Note for students: We reached the edge. That is not safe even if the rest of the map looks clean.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started