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[]) { // 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(3.1415, 5.00)))); System.out.println("Area = "+(doisDigitos.format(Calc.Lado(3.1415, 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
CRUD vehicules
4th ques
Merge Sort in Java
Num ways to decode a string -Facebook interview
1(D)
do while
Check Case
different ways to add parenthesis leetcode #241
Java Functional Programming
Info by dfs