Fundamentals of Java functions

Source: Internet
Author: User

Package dubeg02; Trapezoid area

public class Tast {
public static int Add (int a, int b, int c) {
int D = (A + b) * C/2;
ToString (A, B, c);
return D;
}

public static void toString (int a, int b, int c) {
System.out.println ("Long" + a);
System.out.println ("width" + b);
System.out.println ("high" + C);
}

public static void Main (string[] args) {
int a = 22;
int b = 15;
int c = 17;
int sum = Add (A, B, c);
System.out.println ("trapezoid area" + sum);
}
}

Package dubeg02; Rectangular area//

public class Tast01 {
public static int Add (int a, int b) {
int C = a*b;
ToString (A, b);
return C;
}

public static void toString (int a, int b) {
System.out.println ("Long" + a);
System.out.println ("width" + b);
}

public static void Main (string[] args) {
int a = 13;
int b = 999;
int sum = Add (a, b);
System.out.println ("rectangular area" + sum);
}
}

Package dubeg02; triangular area//

public class Tast03 {
public static int Add (int a, int b) {
int C = A*B/2;
ToString (A, b);
return C;
}

public static void toString (int a, int b) {
System.out.println ("Long" + a);
System.out.println ("width" + b);
}

public static void Main (string[] args) {
int a = 1234;
int b = 5678;
int sum = Add (a, b);
System.out.println ("triangular area" + sum);
}
}

Package dubeg02; Circle Area//

public class Tast04 Circle {
public static int Add (int r) {
int b= (int) (MATH.PI*R*R);
ToString (R);
return b;
}
public static void toString (int r) {
System.out.println ("radius" +r);
}
public static void Main (string[] args) {
int r= 123;
int sum= Add (r);
System.out.println ("Round area" +sum);

}
}

Fundamentals of Java functions

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.