ReferenceS Mallings Enable Editing can contain viruses. Unless you need to edit, it's safer to stay in Protected View. University of Bahrain College of Information Technology Department of Computer...

Please help with simple java code i/o
ReferenceS<br>Mallings<br>Enable Editing<br>can contain viruses. Unless you need to edit, it's safer to stay in Protected View.<br>University of Bahrain<br>College of Information Technology<br>Department of Computer Science<br>ITCS114: Introduction to Computer Science<br>Assignment 4: Files<br>Write a java program that reads the width and length for a set of rectangles (unknow numbers)<br>from input file (input.bxt). The program should compute the area for each rectangle and store the<br>result in a file called (Output.txt).<br>Also, you need to consider the following cases:<br>1- If width and length are equal, then a message (This is a square) should be displayed instead of<br>area.<br>2- If width or length has negative values, then invalid message should be displayed instead of<br>I<br>the area.<br>Input.txt:<br>6.0 2.0<br>4.0 4.0<br>2.0 4.0<br>-4.0 5.0<br>Output.txt:<br>Rectangle(1) - Area = 12.0<br>Rectangle(2) - ERROR, this is square not rectangle!<br>Rectangle(3) - Area = 8.0<br>Rectangle(4) - ERROR, Invalid width or length number!!<br>

Extracted text: ReferenceS Mallings Enable Editing can contain viruses. Unless you need to edit, it's safer to stay in Protected View. University of Bahrain College of Information Technology Department of Computer Science ITCS114: Introduction to Computer Science Assignment 4: Files Write a java program that reads the width and length for a set of rectangles (unknow numbers) from input file (input.bxt). The program should compute the area for each rectangle and store the result in a file called (Output.txt). Also, you need to consider the following cases: 1- If width and length are equal, then a message (This is a square) should be displayed instead of area. 2- If width or length has negative values, then invalid message should be displayed instead of I the area. Input.txt: 6.0 2.0 4.0 4.0 2.0 4.0 -4.0 5.0 Output.txt: 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!!

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here