Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Convert this c++ code to another language as in java, python, or c# #include stdafx.h #include #include #include using namespace std; int get_area(int width, int

Convert this c++ code to another language as in java, python, or c#

#include "stdafx.h"

#include

#include

#include

using namespace std;

int get_area(int width, int height) {

return width * height;

};

int main()

{

string name; //varaible declaration

char ch1;

int wid, hei, i, j, ch;

do {

cout << "What would you like to do" << endl;

cout << "1) Set Box Values" << endl;

cout << "2) Show Box Values" << endl;

cout << "3) Exit Program" << endl;

cin >> ch; //accepting choice from user

switch (ch)

{

case 1: //accepting the details from user

cout << "What would you like to name the box?" << endl;

cin >> name;

cout << "What character should the box be filled with?" << endl;

cin >> ch1;

cout << "What is the width of the box?" << endl;

cin >> wid;

cout << "What is the height of the box?" << endl;

cin >> hei;

break;

case 2: //displaying the details

cout << "Hello, I'm a box! My name is Boxie";

cout << " and I am " << wid << " characters wide and " << hei << " characters tall." << endl;

cout << "My area is " << wid*hei << " characters squared." << endl;

cout << "This is an ASCII representation of me:" << endl;

for (i = 1; i <= wid; i++)

cout << "-";

cout << endl;

for (j = 0; j < hei - 2; j++)

{

cout << "|";

for (i = 1; i <= wid - 2; i++)

cout << ch1;

cout << "|";

cout << endl;

cout << "|";

for (i = 1; i <= wid - 2; i++)

cout << ch1;

cout << "|";

cout << endl;

}

for (i = 1; i <= wid; i++)

cout << "-";

cout << endl;

break;

case 3:

exit(0);

default:

cout << "Invalid Choice";

break;

}

} while (ch != 3);

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

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago