<?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...
IN JAVA For the following questions, “define a class” means the following: • Create an appropriately-named file containing the Java class definition, including the following: – A block comment describing the file (and hence the class), as always – Any instance variables, as required by the question – Accessor (getter) and mutator (setter) methods for any instance variables – Constructors as appropriate or as required by the question – A toString method that prints instances of the class informatively –...
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...
import math ''' Finish the code below as described. Use the completed class Square as an example. ''' class Square: ''' Each Square has a width and can calculate its area, its perimeter, and return a string representation of itself. ''' def __init__(self, width): ''' (float) -> None Create a new Square with the given width. ''' self.width = width def get_area(self): ''' () -> float Return this square's area. ''' return self.width*self.width def get_perimeter(self): ''' () -> float Return...
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...