(a) The area of a rectangle is given as area=width*height
You are given the variable double A,wd,ht.
C++ Statement:- double A,wd,ht;
A=wd*ht;
(b) The Surface area of a cube is given as area=2ab+2ac+2bc
where a,b,c are the lenght,width and height.
you are given the variable double A,a,b,c.
C++ Statement:- double A,a,b,c;
A= 2*a*b + 2*a*c + 2*b*c;
(c) The volume of a regular pyramid is given as
V=(1/3)(w*l*h).
You are given the variable double V,w,l,h;
C++ Statement:- double V,w,l,h;
V= (w*l*h)/3.0;
Convert the below 3 statements in English to c++ equivalent. a) The area of a rectangle...
Using basic c++ write a separate code for each of the following: 1. Area Rectangle • Write a program that asks the user to enter length and width of a rectangle and then display the rectangles area. • Write the following functions • getLength – prompt the user to enter length and return that value as a double • getWidth – prompt the user to enter width and return that value as a double • getArea – This method should...
java language
Problem 3: Shape (10 points) (Software Design) Create an abstract class that represents a Shape and contains abstract method: area and perimeter. Create concrete classes: Circle, Rectangle, Triangle which extend the Shape class and implements the abstract methods. A circle has a radius, a rectangle has width and height, and a triangle has three sides. Software Architecture: The Shape class is the abstract super class and must be instantiated by one of its concrete subclasses: Circle, Rectangle, or...
Define an interface named Shape with a single method named area that calculates the area of the geometric shape: public double area(); Next, define a class named Circle that implements Shape. The Circle class should have an instance variable for the radius, a constructor that sets the radius, an accessor and a mutator method for the radius, and an implementation of the area method. Define another class named Rectangle that implements Shape. The Rectangle class should have instance variables...
please answer all
C. 2. What rectangle has the smallest perimeter, for a given area? Suppose you want a rectangle with area 200. What choice of length L and width W will give the smallest perimeter? a. Sketch a rectangle and label it as having length L and width W. b. Write the area in terms of length and width: A = Write the perimeter in terms of length and width: P = d. If L = 200 and W...
Hey I'm trying to convert this C code into ARMv8 however I'm having severe difficulty while doing it. This is just for personal practice to develop my skills. Thank you! // Code starts here // This is a C language code below #define FALSE 0 #define TRUE 1 struct coord { int x, y; }; struct size { int width, length; }; struct pyramid { struct coord center; struct size base; int height; int volume; }; struct pyramid newPyramid(int width,...
in C++ use Inheritance for the following Shape Circle Sphere Cylinder Rectangle Square Cube You must define one class for each shape. And, use public inheritance when deriving from base classes. Circle int r; void area(); void perimeter(); void volume(); //No volume for circle Sphere int r; void area();//Sphere surface area= 4 × pi × radius2 void perimeter(); //No perimeter for Sphere void volume();//Sphere volume= 4/3 × pi × radius2 Cylinder int r, height; void area();// Cylinder surface area=perimeter of...
Question 4.4: Write an overloaded function of function area with 3 (float) parameters. This function should calculate and print out the product of the 3 parameters. Question 4.4: Write the main function to test question 4.1, 4.2, 4.3, 4.4. Your main function should ask if the user want to calculate the area of a rectangle or a circle or a triangle then print out the result accordingly. (Use switch structure). For example: Please enter (r) for rectangle, (t) for triangle,...
For this lab you will be creating a class representing the shape square. A Square is a special case of a Rectangle where both sides have the same length. Rectangle has been provided for your use in this lab. A Rectangle has a height and a width as member variables, two constructors, two member functions, area() and perimeter(), and lastly, an input and output operator. Your Square class should publicly inherit from Rectangle. You will need to update the Constructors...
8. Find the surface area of the part of the plane z+y+z4 over the rectangle [0, 1]x[0,2 b) 3 c) 2v3 d) 8 e) 12
8. Find the surface area of the part of the plane z+y+z4 over the rectangle [0, 1]x[0,2 b) 3 c) 2v3 d) 8 e) 12
3. Using Excel to solve the problems below If there is cube which has length I 9m and width w-5m the height of the cube could be represented as h, the total surface area could be calculated as: S-2 (w l +w h+h l) If h increases from 1m to 15m, each time h increases 1m, build a table in Excel to include 2 columns, one is for h and the other is the calculated total surface area S. Plot...