Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
test1
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; import java.text.DecimalFormat; class Rextester { public static void main(String args[]) { final double pi = 3.1415; // Instancia Objeto Calculadora Calc = new Calculadora(); DecimalFormat doisDigitos = new DecimalFormat("###,##0.000"); // Chamada de Métodos System.out.println("total da soma = "+Calc.Soma(5, 10)); System.out.println("total da subtração = "+Calc.Subtracao(5, 10)); System.out.println("total da multiplicação = "+Calc.Multiplicacao(5, 10)); System.out.println("Area = "+(doisDigitos.format(Calc.Area(pi, 5.00)))); System.out.println("Area = "+(doisDigitos.format(Calc.Lado(pi, 5.00)))); } } class Calculadora { // Métodos public int Soma(int num_1, int num_2) { return(num_1 + num_2); } public int Subtracao( int num_1, int num_2 ) { if( num_1 > num_2 ) return(num_1 - num_2); return( num_2 - num_1 ); } public int Multiplicacao( int num_1, int num_2 ) { return(num_1 * num_2); } static double Quad(double num) { return(num * num); } public double Area( double num_1, double num_2 ) { return(num_1 * Quad(num_2)); } public double Lado( double num_1, double num_2 ) { return(num_1 * num_2); } }
run
|
edit
|
history
|
help
0
Test processing time (loop vs. contains)
Quadratic equation
Leetcode 297. Serialize and Deserialize Binary Tree
Print Longest String
Date_From_Str
vechile
Check Case
Matcher Example (not my)
Preference List
Java: Tower of Hanoi