非視窗化的輸入
Project 5
/*非視窗化*/package homework4;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class homework4
{
public static void main (String[] args) throws IOException
{
BufferedReader keyin= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please enter the purchase price of an item.");
int P = Integer.parseInt(keyin.readLine());
System.out.println("Please enter the expected number of years of service.");
int Y = Integer.parseInt(keyin.readLine());
System.out.println("Please enter the expected salvage value.");
int S = Integer.parseInt(keyin.readLine());
int D=(P-S)/Y;
System.out.println("The yearly depreciation for item is "+ D +".");
}
}
0 Comments:
Post a Comment
<< Home