Question: 1. Write a Java program to find the perimeter and area of a rectangular field, given its length and width in yards. 1. Declare variables

 1. Write a Java program to find the perimeter and area

1. Write a Java program to find the perimeter and area of a rectangular field, given its length and width in yards. 1. Declare variables for length, width, perimeter and area. Use the naming conventions discussed in class 2. Initialize the length and width with some particular values (like 12.25 and 5.82) 3. For finding the perimeter of the rectangle use the formula: perimeter 2 (length + width) 4. For finding the area of the rectangle use the formula: area 5. Show the output in the following format: length width The perimeter of the rectangle with the length = xx.xx yards and the width xxxx yards is xx.xx yards The area of the rectangle with the length xxxx yards and the width = xx.xx yards is xx.xx square yards. Make changes to the programs so that you take input using the scanner dass (instead of using the assignment operator) and send output using System.out.printf. Floating-point numbers should have two decimals. 6. Test your program for different values of length and width

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!