Below 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. RoadTest.cpp:  #define CATCH_CONFIG_MAIN static const int TEST_WIDTH = 15; static const int TEST_LENGTH = 200; #include "../Road.h" #include TEST_CASE("Should be able to set and get the width") { Road road; road.setWidth(TEST_WIDTH); int width = road.getWidth(); REQUIRE(width == TEST_WIDTH); } TEST_CASE("Should be able to set and get the length") { Road road; road.setLength(TEST_LENGTH); int length = road.getLength(); REQUIRE(length == TEST_LENGTH); } TEST_CASE("Should be able to get the Asphalt") { Road road; road.setWidth(TEST_WIDTH); road.setLength(TEST_LENGTH); float asphalt = road.asphalt(6); REQUIRE(asphalt == 7920000); } TEST_CASE("Copy Constructor should copy the width and Length"){ Road road; road.setWidth(TEST_WIDTH); road.setLength(TEST_LENGTH); Road copy = road; int width = copy.getWidth(); REQUIRE(width == TEST_WIDTH); int length = copy.getLength(); REQUIRE(length == TEST_LENGTH); } TEST_CASE("Copy Assignment Operator should copy the width and length") { Road road; road.setWidth(TEST_WIDTH); road.setLength(TEST_LENGTH); Road copy; copy = road; int width = copy.getWidth(); assert(width == TEST_WIDTH); int length = copy.getLength(); assert(length == TEST_LENGTH); } RoadDriver.cpp: #include using namespace std; #include "Road.h" int main() {     std::cout << "Hello, Road Driver!" << std::endl;     return 0; } Road.cpp:  #include "Road.h" Road.h : #ifndef Road_h #define Road_h #endif

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 17RQ
icon
Related questions
Question
100%

Below 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.

RoadTest.cpp: 

#define CATCH_CONFIG_MAIN

static const int TEST_WIDTH = 15;
static const int TEST_LENGTH = 200;

#include "../Road.h"
#include <catch2/catch_test_macros.hpp>

TEST_CASE("Should be able to set and get the width") {
Road road;
road.setWidth(TEST_WIDTH);
int width = road.getWidth();
REQUIRE(width == TEST_WIDTH);
}

TEST_CASE("Should be able to set and get the length") {
Road road;
road.setLength(TEST_LENGTH);
int length = road.getLength();
REQUIRE(length == TEST_LENGTH);
}

TEST_CASE("Should be able to get the Asphalt") {
Road road;
road.setWidth(TEST_WIDTH);
road.setLength(TEST_LENGTH);
float asphalt = road.asphalt(6);
REQUIRE(asphalt == 7920000);
}

TEST_CASE("Copy Constructor should copy the width and Length"){
Road road;
road.setWidth(TEST_WIDTH);
road.setLength(TEST_LENGTH);

Road copy = road;
int width = copy.getWidth();
REQUIRE(width == TEST_WIDTH);

int length = copy.getLength();
REQUIRE(length == TEST_LENGTH);
}

TEST_CASE("Copy Assignment Operator should copy the width and length") {
Road road;
road.setWidth(TEST_WIDTH);
road.setLength(TEST_LENGTH);

Road copy;
copy = road;

int width = copy.getWidth();
assert(width == TEST_WIDTH);

int length = copy.getLength();
assert(length == TEST_LENGTH);

}

RoadDriver.cpp:

#include <iostream>
using namespace std;

#include "Road.h"

int main() {
    std::cout << "Hello, Road Driver!" << std::endl;
    return 0;
}

Road.cpp: 

#include "Road.h"

Road.h :

#ifndef Road_h
#define Road_h


#endif

Road Class
The Road Class is intended to calculate the amount of asphalt required to pave a road that is x feet width by y miles
long by z inches deep.
Note: There are 5,280 feet in a mile
Public Interface:
• getWidth():int returns the width in feet
• set Width(feet:int):void sets the width in feet
● getLength(): int returns the length in miles
• setLength(miles:int):void sets the length in miles
asphalt(thickness:int):double returns amount of asphalt, in cubic feet, required to pave the road at a given
thickness in inches.
Driver:
The driver should demonstrate all the features of the class.
- width: int
- length: int
Road
+ getwidth(): int
+ setwidth(feet: int) : void
+ getLength(): int
+ setlength(miles: int) : void
+ asphalt(thikness: int): double
Transcribed Image Text:Road Class The Road Class is intended to calculate the amount of asphalt required to pave a road that is x feet width by y miles long by z inches deep. Note: There are 5,280 feet in a mile Public Interface: • getWidth():int returns the width in feet • set Width(feet:int):void sets the width in feet ● getLength(): int returns the length in miles • setLength(miles:int):void sets the length in miles asphalt(thickness:int):double returns amount of asphalt, in cubic feet, required to pave the road at a given thickness in inches. Driver: The driver should demonstrate all the features of the class. - width: int - length: int Road + getwidth(): int + setwidth(feet: int) : void + getLength(): int + setlength(miles: int) : void + asphalt(thikness: int): double
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Developing computer interface
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,