#include <iostream>
#include <string>
using namespace std;
class Box
{
public:
Box() : length(0), width(0), height(0) {}
/* Todo */
void setLength(int _l) { length = _l; }
/* Todo */
int getLength() { return length; }
/* Todo */
/* Todo */
// 1. calculateVolume() 2. calculateSurfaceArea()
private:
int length, width, height;
};
// Don't touch main()
int main()
{
int testcase = 0;
cin >> testcase;
if (testcase == 1)
{
Box box = Box();
cout << "Length: " << box.getLength() << ", Width: " << box.getWidth() << ", Height: " << box.getHeight() << endl;
box.setLength(300);
box.setWidth(400);
box.setHeight(500);
cout << "Length: " << box.getLength() << ", Width: " << box.getWidth() << ", Height: " << box.getHeight() << endl;
}
else if (testcase == 2)
{
Box box = Box(17, 17, 34);
cout << "Length: " << box.getLength() << ", Width: " << box.getWidth() << ", Height: " << box.getHeight() << endl;
box.setLength(101);
box.setWidth(50);
box.setHeight(34);
cout << "Length: " << box.getLength() << ", Width: " << box.getWidth() << ", Height: " << box.getHeight() << endl;
}
else if (testcase == 3)
{
Box box = Box(100, 17, 17);
cout << "Length: " << box.getLength() << ", Width: " << box.getWidth() << ", Height: " << box.getHeight();
cout << ", Surface Area: " << box.calculateSurfaceArea() << ", Volume: " << box.calculateVolume() << endl;
}
else if (testcase == 4)
{
Box box = Box();
cout << "Length: " << box.getLength() << ", Width: " << box.getWidth() << ", Height: " << box.getHeight();
cout << ", Surface Area: " << box.calculateSurfaceArea() << ", Volume: " << box.calculateVolume() << endl;
box.setLength(44);
box.setWidth(200);
box.setHeight(1);
cout << "Length: " << box.getLength() << ", Width: " << box.getWidth() << ", Height: " << box.getHeight();
cout << ", Surface Area: " << box.calculateSurfaceArea() << ", Volume: " << box.calculateVolume() << endl;
}
else if (testcase == 5)
{
Box box = Box(10000, 20000, 30000);
cout << "Length: " << box.getLength() << ", Width: " << box.getWidth() << ", Height: " << box.getHeight();
cout << ", Surface Area: " << box.calculateSurfaceArea() << ", Volume: " << box.calculateVolume() << endl;
}
return 0;
}
No need to handle input. (Input would be number 1~5 to represent the index of test-case)