Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
100%

elow for each class you find a UML and description of the public interface. Implementing the public interface as described is madatory. There's freedom on how to implement these classes.The private properties and private methods are under your control.. There are multiple ways of implementing all these classes. Feel free to add private properties and methods.

For each object, it's mandatory to create a header file (.h), implementation file (.cpp) and a driver. Blank files are included. The header should have the class definition in it. The implementation file should contain the implementations of the methods laid out in the header fine. And finally the Driver should test/demonstrate all the features of the class. It's best to develop the driver as the class is being written. Check each section to see if there are added additional requirements for the driver. Two test suites are included so that work can be checked. It's important to implement the drivers to test and demonstrate Classes functionality.

RectTest.cpp

#define CATCH_CONFIG_MAIN
#include "../Rect.h"
#include <catch2/catch_test_macros.hpp>


TEST_CASE("Should be able to create a Rect with a default constructor") {
Rect *rectangle = new Rect();
}

TEST_CASE("getWidth should return the width of the rectangle") {
Rect *rectangle = new Rect();
REQUIRE(0 == rectangle->getLength());
}

TEST_CASE("getwidth should return with width of the rectangle") {
Rect *rectangle = new Rect();
REQUIRE(0 == rectangle->getwidth());
}

TEST_CASE("Should be able to create a rect with a width and height") {
Rect *rectangle = new Rect(7,9);
}

TEST_CASE("By default a rect object should have a width and height of 0") {
Rect *rectangle = new Rect();
CHECK(0 == rectangle->getLength());
CHECK(0 == rectangle->getwidth());
}


TEST_CASE("Should be able to set the width") {
Rect *rectangle = new Rect();

}

TEST_CASE("Should get area with integer") {
Rect rectangle;

rectangle.setWidth(4);
rectangle.setLength(3);

REQUIRE(rectangle.area() == 12);
}

TEST_CASE("Should get perimeter with integer") {
Rect rectangle;

rectangle.setWidth(4);
rectangle.setLength(3);

REQUIRE(rectangle.perimeter() == 14);
}


TEST_CASE("Should get lengthIsGreater with integer") {
Rect rectangle;

rectangle.setWidth(4);
rectangle.setLength(3);

REQUIRE(!rectangle.lengthIsGreater());
}

RectDriver.cpp:
#include <iostream>

int main() {
std::cout << "Hello, Rect Driver!" << std::endl;
return 0;
}
Rect.cpp:
#include "Rect.h"

Rect.h :
#ifndef Rect_h
#define Rect_h


#endif
[画像:Rect Class The Rect class will model a rectangle (1 couldn't use the class name Rectangle because it's reserved on some Windows computers.) The Rect class should have a width and length. Public Interface: • setWidth(width:int):void sets the width getWidth():int returns the width setLength(length:int):void getLength():int returns the length lengthls Longer():bool returns true if the length is longer くろまる perimeter():int return the perimeter • area():int returns the area くろまる くろまる くろまる くろまる Driver: The driver should demonstrate all the features of the class. -length width: int : int + + setwidth(width: int) : void + getwidth() : int + Rect ·setlength(iength: int) : void getlength(): int lengthisLonger(): bool + sets the length + perimeter(): int + area(): int]
expand button
Transcribed Image Text:Rect Class The Rect class will model a rectangle (1 couldn't use the class name Rectangle because it's reserved on some Windows computers.) The Rect class should have a width and length. Public Interface: • setWidth(width:int):void sets the width getWidth():int returns the width setLength(length:int):void getLength():int returns the length lengthls Longer():bool returns true if the length is longer くろまる perimeter():int return the perimeter • area():int returns the area くろまる くろまる くろまる くろまる Driver: The driver should demonstrate all the features of the class. -length width: int : int + + setwidth(width: int) : void + getwidth() : int + Rect ·setlength(iength: int) : void getlength(): int lengthisLonger(): bool + sets the length + perimeter(): int + area(): int
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
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
    SEE MORE QUESTIONS
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education