*JAVA Modify the Area and Perimeter Calculator In this exercise, you?ll modify the Area and PerimeterCalculator so...
Question:
*JAVA
Modify the
Area and Perimeter
Calculator
In this exercise, you?ll modify the Area and PerimeterCalculator so it
allows the user to
enter the length and width on the same line.
Review the application
1.
Open the project named ch09_ex4_AreaAndPerimeter
in the extra_ex_starts directory.
2.
Open the Main class and review its code.
3.
Run the application to make sure it works correctly.
Modify the application so it allows two entries on thesame line
4.
In the Main class, modify the code that gets the
length and the width so it prompts the user to
enter the length and width
on the same line.
Then, parse the string that?s entered
by the user to get
one String object for the length and another for the width.
5.
Modify the code that displays the data for the
Rectangle object so that it includes the length
and width.
6.
Run the application to make sure it works correctly.
If the user enters 100 and 20, the
data that?s printed to the console should look something likethis:
Enter length and width: 100 20
Length: 100.0
Width: 20.0
Area: 2,00
0.000
Perimeter: 240.000
Here is the code: