You are on page 1of 2

Numresults1

import javax.swing.*;

public class NumResults1{

public static void main (String[] args){

float a = Float.parseFloat(JOptionPane.showInputDialog("Enter Positive Realn Number"));

int b = Integer.parseInt(JOptionPane.showInputDialog("Enter Integer"));

System.out.println("base"+" "+"power" +" "+" square root "+" raised to the power of the
second number " );

double c = Math.sqrt(a);

double ab = Math.pow(a,b);

System.out.print (a + " "+b+" " +c+" "+ab);

}
Cooldrinks
import javax.swing.JOptionPane;

public class CoolDrinks


{
public static void main (String[] args)
{

double a = 7.89;
int b = Integer.parseInt (JOptionPane.showInputDialog ("How many cooldrinks?"));
System.out.println("You ordered: " + b + " cooldrinks");
double c = a * b;
System.out.println("You owe: " + c);
int d = Integer.parseInt (JOptionPane.showInputDialog (" How Would You Like To Pay?"));
double e = d - c;
e=e * 100;
e = Math.round (e);
e = e / 100;
System.out.println("Your change: R" + e);
}
}

You might also like