PackageMianxiangduixiang;//trapezoidal Public classLadder {DoubleShangdi; DoubleXiadi; DoubleGao; DoubleMianji; DoubleZhouchang; Ladder (DoubleShangdi,DoubleXiadi,DoubleGao) {//using parameters to initialize properties//Resolve Parameter name duplicate this represents the current class This. Shangdi =Shangdi; This. Xiadi =Xiadi; This. Gao =Gao; } //method naming: verb + name; The first letter of a verb is lowercase//If you need a return value, simply precede the method with the type
Reference: http://iask.sina.com.cn/ B /9499520.html
What is the formula for calculating the perimeter and area of a triangle, rectangle, square, trapezoid, or circle?
Perimeter: girth area: Area
1. Triangle (General triangle, Helen formula)
Triangle
Perimeter L = A + B + C (a, B, c is the length of the three sides
Use polymorphism to find the area and perimeter of the rectangle and the area of the circle my perimeterShape shape = new Circle (5); New Square (5,6);Double area = shape. Getarea ();Double perimeter = shape. Getperimeter ();Console.WriteLine ("The area of this shape is {0}, the perimeter is {1}", Area,
Analysis:In high school, we have learned that we can use rectangular method or rectangular method to find the definite integral.
The idea is to divide the integral interval into n equal parts, then approximate the n equal equal to the rectangle (or trapezoid), and then sum the area of all the rectangles (or trapezoidal).
A simple example:The definite integral of the function x^2
Rectangular method:
//using the idea of object-oriented polymorphism to find the area and perimeter of circle and rectangle respectivelyStatic voidMain (string[] args) { Sharp Sharp=NewCircle (5); DoubleArea=Sharp . Getarea (); DoublePerimeter=Sharp . Getperimeter (); Console.WriteLine ("area is {0}, perimeter is {1}", Area,
DescriptionThere is a piece of paper in front of Tom, it length and width are integers. Tom knows the area of this paper, he wants to know the minimum perimeter of this paper.InputIn the first line, there are an integer T indicates the number of test cases. In the next T-lines, there is only one of the integer-n-Every line, indicates the area of paper.$T \leq 10,n\leq {10}^{9}$OutputFor each case, output a integer, indicates the answer.Sample Input3 2
Let the three side length, judge whether the triangle can be formed, if possible, to find its area and perimeterProgram:#include #include int Main (){Double A, B, C, D, S, area;printf ("Please enter three positive numbers:");scanf ("%lf%lf%lf", a,b,c);if ( (A + B > C) (A + C > B) (b + C > a)){D = A + B + C;s = 0.5*d;Area = sqrt (s* (s-a) * (s-b) * (s-c));printf ("d=%lf\tarea=%lf\t", D,area); //' \ t ' adjusts the output position to make the output d
/* (Start of program header comment) * Copyright and version declaration of the program part * Copyright (c) 2011, Yantai University School of Computer Students * All rights reserved. * File Name: * Author: Shangpeng * Completion Date: May 28, 2012 * Version number:
* Description of task and solution method * Input Description: * Problem Description: Window program first experience, to find the area and perimeter
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.