Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package exercise.pkg14;
- import javax.swing.JOptionPane;
- /**
- *
- * @author Monty
- */
- public class Exercise14 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- int y;
- double Y, exp, t, c, b;
- String bacteria = JOptionPane.showInputDialog("Input Initial Bacteria");
- String konstant = JOptionPane.showInputDialog("Input Constant");
- String hours = JOptionPane.showInputDialog("Input Time in Hours");
- int bact = Integer.parseInt(bacteria);
- b = (double) bact;
- int constant = Integer.parseInt(konstant);
- c = (double) constant;
- int time = Integer.parseInt(hours);
- t = (double) time;
- exp = c*t;
- Y = Math.pow(bact, 2);
- y = (int) Y;
- System.out.print("Initial bacteria: " + bact + "\n");
- System.out.print("Concstant value: " + c + "\n");
- System.out.print("Time (hours): " + t + "\n");
- System.out.print(y + " bacteria will be present after " + t + " hours.\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement