Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design (pseudocode and scource code in C# or JAVA a program that defines the following 3 methods: Method isValid() returns true if the sum of

Design (pseudocode and scource code in C# or JAVA a program 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 prompts the user to enter the width and height of a rectangle and uses 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

Entered height: 5

This is invalid rectangle. Try again

Sample run 2:

Entered width: 20

Entered height: 15

Area: 300

Perimeter: 70

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions