
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Please answer in c++
the sample output is also attached please reach out for any questions

Transcribed Image Text:**Design and Implement Program**
Develop a program that implements the following three methods:
- **Method `isValid(...)`:**
Returns `true` if the sum of the width and height is greater than 30.
```java
boolean isValid(double width, double height) {}
```
- **Method `Area(...)`:**
Returns the area of the rectangle if it is a valid rectangle.
```java
double Area(double width, double height) {}
```
- **Method `Perimeter(...)`:**
Returns the perimeter of the rectangle if it is a valid rectangle.
```java
double Perimeter(double width, double height) {}
```
**Important Note:**
Always remember that in Java and C#, the methods must be `public` and `static`.
**Instructions for the Main Method:**
The main method should prompt the user to enter the width and height of a rectangle (as double values) and use the methods to print out a message followed by the area and perimeter if the rectangle is valid. Otherwise, it only prints the message:
"This is an invalid rectangle."
**Note:**
The method `isValid(...)` is used to validate the input before attempting to compute the area and perimeter.
**Additional Design Requirement:**
Design the main method in the test program such that it allows the user to re-run the program with different inputs (using a sentinel loop structure).

Transcribed Image Text:This is a transcription of a computer program output along with instructions for students. The program seems to validate rectangles and calculate their area and perimeter:
---
This is an invalid rectangle
Do you want to enter another width and height (Y/N)? : **Y**
Enter width: **20.0**
Enter height: **15.0**
This is a valid rectangle
The area is: **300.0**
The perimeter is: **70.0**
Do you want to enter another width and height (Y/N)? : **N**
Program Ends
---
**Instructions:**
- Programs must be working correctly.
- **Programs must be saved in files with the correct file name.**
- If working in Java or C#, class names must be correct.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- C++ please solve the equationnnnnnarrow_forwardWrite the magic number program in C++ so that the user can guess at more than one magic number where the magic number is an integer between 1 and 20. When the program is run, the user should be prompted if they would like to guess at a magic number and continue to be prompted as such after they have guessed a magic number correctly. A while loop is necessary for this capability, The user should be given as many guesses as necessary for each number until they guess the number correctly. A do-while loop must be implemented for this part of the program. They should also be responded with a clue after each guess on whether the guess is too high or low. The program should also make sure that if the user enters an invalid guess at the magic number (less than 1 or greater than 20), then the user should be prompted with an invalid guess message and not be penalized for a guess attempt. A while loop must be implemented for this part of the program. After the user guesses the number…arrow_forwardPlease in C++, thank you.arrow_forward
- Can you code a loop using any of loop types in C++ (while, do-while and for)? Please support your statement with sample code. If your answer is yes, which loop type do you prefer in your sample code? Why?arrow_forwardc++arrow_forwardThis is very helpful thank you. If possible can you please show me how to make the function with the original parameters C++arrow_forward
- in C++ Write an inductive function, called IndFn, for adding 12+10+8+6+4 Write a function with a procedural loop, called ProFun, for adding 14+12+10+8+6+4;arrow_forwardNeed help figuring out this program and typing it in c++.arrow_forwardWhat is wrong with the following code? When ran, the code is supposed to generate a mad-lib for the user to fill in. However, when ran, the program encounters an error. the language used is C++ istrname is instructor name and studnamef and studnamel are the first and last name of a student repesectfullly. and rotfood is a rotten food. The output for the mad lib is completely up to the user.arrow_forward
- Don't give me AI generated answer or plagiarised answer.arrow_forwardC++ Question Hello, Please create the correct code for the attached picture. Please create the code based on the given requirements. Please make sure it is working. Thank you!arrow_forwardThis assignment will give you practice on basic C programming. You will implement a few Cprogramsarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education