it4life - Portal de Informática

ntome


1.0 user
5 posts

Código: js
package Project_pl5;import java.util.Scanner;
public class Main_ex5 { public static void volCilindro (double a, double r) { double v_c = 3.14 * (r*r) * a; System.out.println("o volume do cilindros" + v_c); } public static void volCone (double a, double r) { //(1/3) * pi double v_cones = 0.33 * 3.14 * (r*r) * a; System.out.println("o volume do cone" + v_cones); } public static void volEsfera (double r) { //(4/3) * pi double v_e = 1.33 * 3.14 * (r*r); System.out.println("o volume da esfera" + v_e); } public static void main(String[] args) { // TODO code application logic here double alt, raio, v_c, v_cones, v_e; String nome; do { Scanner ler =new Scanner (System.in); System.out.println("Inscreva o nome"); nome = ler.next(); if (nome == null ? "cilindros" == null : nome.equals("cilindros")) { Scanner ler1 =new Scanner (System.in); System.out.println("Inscreva alt "); alt = ler1.nextDouble (); Scanner ler2 =new Scanner (System.in); System.out.println("Inscreva raio "); raio = ler2.nextDouble (); volCilindro (alt, raio); } if (nome == null ? "cones" == null : nome.equals("cones")) { Scanner ler3 =new Scanner (System.in); System.out.println("Inscreva alt "); alt = ler3.nextDouble (); Scanner ler4 =new Scanner (System.in); System.out.println("Inscreva raio "); raio = ler4.nextDouble (); volCone (alt, raio); } if (nome == null ? "esferas" == null : nome.equals("esferas")) { Scanner ler5 =new Scanner (System.in); System.out.println("Inscreva raio "); raio = ler5.nextDouble (); volEsfera (raio); } } while (nome == null ? "fim" != null : !nome.equals("fim")); }}

Segue-nos nas redes sociais