星期一, 10月 24, 2005

PROJECT2.05

PROJECT2.05

import javax.swing.JOptionPane;
public class q3 {
public static void main(String[] args) {

String PP=JOptionPane.showInputDialog("Enter a purchase price");
double P=Integer.parseInt(PP);
String SS=JOptionPane.showInputDialog("Enter a expected number");
double S=Integer.parseInt(SS);
String YY=JOptionPane.showInputDialog("Enter a expected salvage value ");
double Y=Integer.parseInt(YY);
double D=(P-S)/Y;
System.out.println("the purchase price of an item: "+P);
System.out.println("the expected salvage value: "+S);
System.out.println("the expected number of years of service:"+Y);
JOptionPane.showMessageDialog(null,"the yearly depreciation for the item: "+D);
System.exit(0);
}
}


  • 程式結果連結
  • 0 Comments:

    張貼留言

    << Home