Project 2.03 (1st ed.)
Project 2.03 (1st ed.)
import javax.swing.JOptionPane;
public class Project203
{
public static void main(String arg[])
{
String p_str = JOptionPane.showInputDialog("Enter the purchase: ");
double Pri = Double.parseDouble(p_str);
String s_str =JOptionPane.showInputDialog("Enter the salvage: ");
double Val = Double.parseDouble(s_str);
String y_str = JOptionPane.showInputDialog("Enter the number of years the item is used: ");
double Year = Double.parseDouble(y_str);
double D;
D = (Pri - Val) / Year;
System.out.println("The yearly depreciation for the item is"+ D);
JOptionPane.showMessageDialog(null, "The yearly depreciation for the item is"+ D);
System.exit(0);
}
}
0 Comments:
張貼留言
<< Home