source file name: Expenses.java
class Expenses
{
public static void main(String args[])
{
int p=Integer.parseInt(args[0]);
//conversion of Command line values into integer value
if(Integer.parseInt(args[0])>100)
System.out.println("The Price is="+(p-(p*10/100)));
else
System.out.println("The Price="+p);
}
}
output:
D:\JavaPrograms\CmdPrograms>javac Expenses.java
D:\JavaPrograms\CmdPrograms>java Expenses 150
The Price is=135
D:\JavaPrograms\CmdPrograms>java Expenses 90
The Price=90
0 Comments
Post a Comment