Question: Please use java (0.07 point) Prompt the use to enter a number to represent the length of a rectangle by using the system.out.println command. See

Please use java

  1. (0.07 point) Prompt the use to enter a number to represent the length of a rectangle by using the system.out.println command. See figure below for the execution of the code

  2. (0.23 point) Use the Scanner class and create a scan object that allows you to scan user input, hint to scan user inputs the Scanner Constructor parameter should be System.in.

Read the user input as integer using the scan object and stored it in a variable length.

  1. (0.2 point) Prompt the user to enter the width (you can refer to the code below) and read user input using the same scan object and store the value in a created width.

  2. (0.3 point) Create a Point object locate at (1,2) and create a Dimension object using the length and width entered by the user. Than create a Rectangle object that uses point1 and dimension

  3. (0.15 point) Create an area variable that stores the area of a rectangle and calculate the area of the rectangle you create in 4 and output the area. Hint to get the length and width use the getter from the Rectangle class.

  4. (0.12 point) Output the result of the following expression5 widthlength+2 using the System.out.println and refer to figure below for run

  5. (0.1 point) Output the max xcoodinate of the rectangle, see below.

  6. (0.07 point) Create an ArrayList object arr1 ;

  7. (0.1 points) Add your first name to the arr1, it will be added to the index 0 of the ArrayList

  8. (0.2 point) Declare an ArrayList arr2; and then make arr2=arr1; then add your last name to arr2

  9. (0.23 point) use get method to get the first element of arr2 and then System.out.println this element, briefly explain the result.

  10. (0.22 point) Use size method to get the number of String that has been added to arr1 and use that get the last element of arr1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!