星期日, 10月 23, 2005

project2_5


import javax.swing.JOptionPane;
public class project2_5
{
public static void main(String arg[])
{
String pString=JOptionPane.showInputDialog("Enter the purchase: ");
double myPrice = Double.parseDouble(pString);
String sString=JOptionPane.showInputDialog("Enter the salvage: ");
double myvalue = Double.parseDouble(sString);
String yString=JOptionPane.showInputDialog("Enter the number of years the item is used: ");
double myyear = Double.parseDouble(yString);
double D;
D=(myPrice-myvalue)/myyear;
System.out.println("The yearly depreciation for the item "+ D);
System.exit(0);
}
}

0 Comments:

張貼留言

<< Home