Question: Note: Please provide pseudocode for the problem correctly and source code for java only and the sample run (output) should be the same according to
Note: Please provide pseudocode for the problem correctly and source code for java only and the sample run (output) should be the same according to the question displayed.
Methods Program 1: Design (pseudocode) and implement (source code) a program (name it MyRectangle) that defines the following 3 methods Method isValid) returns true if the sum of the width and height is greater than 30 Method Area () returns the area of the rectangle if it is a valid rectangle Method Perimeter ) returns the perimeter of the rectangle if it is a valid rectangle The main method of MyRectanale prompts the user to enter the width and height of a rectangle and uses MyRectangle methods to print out a message followed by the area and perimeter if the rectangle is valid. Otherwise, it prints out only the message This is invalid rectangle Try again.". Note that method isvalid () is used to validate the input before attempting to compute the area and perimeter Document your code and properly label the input prompt and the outputs as shown below Sample run 1: Entered width: 4 ntered height: 5 This is invalid rectangle. Try again Sample run 2: Entered width 20 Entered height: 15 Area: Perimeter: Sample run 3: Entered width: 10 Entered height: 5 This is invalid rectangle. Try again. Sample run 4: Entered width 30 Entered height: 6 Area: Perimeter: 300 70 180 72
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
