Write a java program that reads the width and length for a set of rectangles (unknow numbers) from input file (input.txt

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write a java program that reads the width and length for a set of rectangles (unknow numbers) from input file (input.txt

Post by answerhappygod »

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!!
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply