This PROGRAM should process the input as a sequence of labeled rectangles. The first word of…

This by macvx”>PROGRAM should process the input as a sequence of labeled rectangles. The first word of input will be a positive integer number indicating how many labeled rectangles follow. Following this will be a description of each labeled rectangle comprised of a single word string label followed by 4 integers that define the x and y coordinates of two opposing corners of the rectangle.

For example, given the following input:

3 A 0 0 10 10 B -5 -2 7 7 C 6 5 3 2

Your program would first read in the value 3 as an integer in order to understand that 3 rectangle definitions will follow. The first rectangle is labeled “A” and is defined by the two points (0,0) and (10,10). The second rectangle is labeled “B” and is defined by the two points (-5,-2) and (7,7). The last rectangel is labeled “C” and is defined by the two points (6,5) and (3,2).

Each rectangle will be defined by two points that represent opposing corners, but this may either by the upper left and lower right corner or lower left and upper right corner.

All coordinates will be given as integers (possibly negative) and all rectangles will be valid (i.e., will have a non-zero width and height). You do NOT have to worry about illegal or invalid input.

Your program should read and process this input in order to calculate and report:

  • The number of rectangles that were square.
  • The number of rectangles that were wider than they were tall.
  • The number of rectangles that were taller than they were wide.
  • The rectangle with the minimum perimeter.
  • The rectangle with the maximum perimeter.
  • The rectangle with the minimum area.
  • The rectangle with the maximum area.

For example, given the input above, your solution should produce the following output:

Square count = 2 Wide count = 1 Tall count = 0 Min perimeter = 12 (C) Max perimeter = 42 (B) Min area = 9 (C) Max area = 108 (B)

If more than one rectangle qualifies as the min/max perimeter/area, your by macvx”>PROGRAM should report the first rectangle entered.

Your program should match the format of the output as shown above (obviously with different actual counts, min/max perimeter/area, and labels as appropriate for the input).

For this program, you should NOT need to store the rectangles in an array or any other sort of collection. This program should be able to process the input one rectangle at a time, keeping track of the results are it goes along and then reporting them once all of the input has been processed.

Do You Need A Similar Assignment?

Place an order with us. Our skilled and experienced writers will deliver a custom paper which is not plagiarized within the deadline which you will specify.

Note; 6 Hours urgent orders deliver also available.

If you need more clarifications contact our support staff via the live chat for immediate response.

 

Type of paper Academic level Subject area
Number of pages Paper urgency Cost per page:
 Total: