Escolar Documentos
Profissional Documentos
Cultura Documentos
import javax.swing.JOptionPane;
public static void main(String[] args) { int opcao = Integer.parseInt(JOptionPane.showInputDialog("Digite a variavel do Lanamento Oblquo desejada: \n1 para velocidade \n2 para tempo \n3 para espao \n4 altura"));
if (opcao == 1) { double tem = Integer.parseInt(JOptionPane.showInputDialog("Digite o tempo (s)")); double veli = Integer.parseInt(JOptionPane.showInputDialog("Digite a velocidade inicial(m/s)")); double g = -9.80065; double velf; double veliy; veliy = Math.sqrt((veli*veli)/2); velf = Math.sqrt((veliy * veliy) + ((veliy + (g * tem))*(veliy + (g * tem)))); JOptionPane.showMessageDialog(null, "A velocidade " + velf + " m/s");
} else if (opcao == 2) {
double veli = Integer.parseInt(JOptionPane.showInputDialog("Digite a velocidade inicial (m/s)")); double esp = Integer.parseInt(JOptionPane.showInputDialog("Digite a altura (m)")); double g = 9.8; double tem1; double tem2; tem1 = (-veli + Math.sqrt((veli * veli) - (4 * g * esp) / 2)) / g; tem2 = (-veli - Math.sqrt((veli * veli) - (4 * g * esp )/ 2)) / g;
JOptionPane.showMessageDialog(null, "O tempo na altura :\n " + tem1 + "s quando est subindo.\n" + tem2 + "s quando est caindo.");
} else if (opcao == 3) { double veli = Integer.parseInt(JOptionPane.showInputDialog("Digite a velocidade inicial (m/s)")); double tem = Integer.parseInt(JOptionPane.showInputDialog("Digite o tempo (s)")); double esp; esp = veli * tem;
} else if (opcao == 4) { double tem = Integer.parseInt(JOptionPane.showInputDialog("Digite o tempo(s)")); double veli = Integer.parseInt(JOptionPane.showInputDialog("Digite a velocidade inicial (m/s)")); double g = 9.8; double alt; alt = veli * tem - g * tem * tem / 2;
} } }