<?php
function areaSquare($side)
{
$areas = $side * $side;
return $areas;
}
function areaR( $side1, $side2)
{
$sumareaR= $side1 + $side2;
return $sumareaR;
}
function sumofshape( $side3 , $side4)
{
$sumarea= $side3 + $side4;
return $sumarea;
}
echo(" Areasqr = " );
$side = 4;
echo(areaSquare($side));
echo(" AreaRec = " );
$side1 = 5;
$side2 = 6;
$side3=areaSquare($side) ;
echo(areaR( $side1, $side2));
$side3=areaSquare($side) ;
$side4=areaR( $side1, $side2);
echo(" Sum= " );
echo(sumofshape( $side3 , $side4));
?>
Please let me know if you have any problems or you want me to change the code. if you find this code useful then don't forget to rate my answer. Thank you so much.
Problems: - create a php script to perform the following operations: - define three variables representing...
Problems: - create a php script to perform the following operations: - define three variables representing the area, width and height of a rectangle, - define two variables representing the area and size of a square. - calculate the area of each shape, and then the sum of two areas. - print the area of each and the sum.
Using Python Write the following well-documented (commented) program. Create a class called Shape that has a method for printing the area and the perimeter. Create three classes (Square, Rectangle, and Circle) which inherit from it. Square will have one instance variable for the length. Rectangle will have two instance variables for the width and height. Circle will have one instance variable for the radius. The three classes will have methods for computing the area and perimeter of its corresponding shape....
Use PHP to perform the following operations: 1. define an array having at least 20 elements representing the grade of some students, i.e., 0<=$grade[i]<=100. 2. find out the length of the array 3. use switch to work on each element, converting a numeric grade to a letter grade and print the letter grade. The rules are below: A 90 - 100 B 80 - 89 C 70 - 79 D 60 - 69 F 0 - 59
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...
Create a program that calculates the area of various shapes.
Console
Specifications
Create an abstract class named Shape. This
class should contain virtual member function named
get_area() that returns a double type.
Create a class named Circle that inherits the
Shape class and contains these constructors and member functions:
Circle(double radius)
double get_radius()
void set_radius(double radius)
double get_area()
Create a class named Square that inherits the
Shape class and contains these constructors and member functions:
Square(double width)
double get_width()
void...
Description Create an object-oriented program that uses inheritance to perform calculations on a rectangle or a square. Sample Output (Your output should be similar to the text in the following box) Rectangle Calculator Rectangle or square? (r/s): r Height: 5 Width: 10 Perimeter: 30 Area: 50 Continue? (y/n): y Rectangle or square? (r/s): s Length: 5 Perimeter: 20 Area: 25 Continue? (y/n): n Thank you for using my app Specifications Use a Rectangle class that provides attributes to store the...
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...
6. define a C++ class having the following members: (1) 2 instance methods the prototype of the first method is double funA(int r). The parameter r represents the radius of a circle. The funA will calculate the area of a circle and the value of its radius is from the parameter r. It will return the area of the circle. the prototype of the second method is double funB(int w, int h). The parameters w and h represent...
Suppose there are two non-empty list variables of equal length in Python called coords and sides. The variable coords contains sub-lists of size 2, with each of these values representing an x and a y co-ordinate. The variable sides also contains sub-lists of size 2, with each of these values representing firstly the length thern the width of a rectangle. Also assume there is also a function in Python called draw_rectangle which takes as its parameters two integers representing firstly...
Write a C code to perform the following tasks: In main: Define an array of SIZE = 7 and initialize them with 3, 5, 7, 9, 11, 13, 15 Call function sum with the array and size as parameters Print each element of the array Print the sum In function sum. Use for-loop to calculate sum