Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1 Convert problems 5 in to template classes, of week 5 and week 4. Test each with Implicit int, float, double, long int. Test

Part 1

Convert problems 5 in to template classes, of week 5 and week 4.

Test each with Implicit int, float, double, long int.

Test each with explicit int, float, double, long int.

Program 5 - Change the code below to match all the questions above.

#include

using namespace std;

class Rectangle {

int width, height;

public:

void set_values (int,int);

int area() { int answer; // complete this function so the code works return answer; } };

void Rectangle::set_values (int x, int y) {

// complete this function so the code works

}

int main () { // Use this driver program

// Use set_values function to set values Rectangle rect1; rect1.set_values (5,6); cout << "area: " << rect1.area() << endl;

// Use set_values function to set values Rectangle rect2; rect2.set_values (3,4); cout << "area: " << rect2.area() << endl; return 0; }

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

Students also viewed these Databases questions