Write a java program that reads the width and length for a set of rectangles (unknow numbers) from input file (input.txt
Posted: Fri May 20, 2022 9:48 am
Write a java program that reads the width and length for a set
of rectangles (unknow numbers) from input file (input.txt). The
program should compute the area for each rectangle and show the
result on the run screen as shown bellow.
Also, you need to consider the following cases:
Input.txt:
6.0 2.0
4.0 4.0
2.0 4.0
-4.0 5.0
Output/run screen :
Rectangle(1) - Area = 12.0
Rectangle(2) - ERROR, this is square not rectangle!
Rectangle(3) - Area = 8.0
Rectangle(4) – ERROR, Invalid width or length number!!
of rectangles (unknow numbers) from input file (input.txt). The
program should compute the area for each rectangle and show the
result on the run screen as shown bellow.
Also, you need to consider the following cases:
Input.txt:
6.0 2.0
4.0 4.0
2.0 4.0
-4.0 5.0
Output/run screen :
Rectangle(1) - Area = 12.0
Rectangle(2) - ERROR, this is square not rectangle!
Rectangle(3) - Area = 8.0
Rectangle(4) – ERROR, Invalid width or length number!!