Results 1 to 5 of 5
- 10-29-2010, 10:30 AM #1
Member
- Join Date
- Oct 2010
- Posts
- 56
- Rep Power
- 0
list values in a number of steps given as a command line argument
Hi there, i have created a program which lists sin values from a specific value to another value when given as command line argument. For example; java SinTable 0 10 90 would produce a table of sin values from 0 to 90 in STEPS of 10.
I cant get the steps of 10 to work:
int sinValue1 = Integer.parseInt(args[0]);
int sinValue2 = Integer.parseInt(args[2]);
int numberOfSteps = Integer.parseInt(args[1]);
System.out.println("-----------------------------------------");
System.out.println("| Sin Table from " + args[0] + " to "
+ args[2] + " in steps of " + args[1]
+ " |");
System.out.println("-----------------------------------------");
for (int index = 0; index < numberOfSteps; index++)
{
System.out.println("| sin(" + index + ")" + "="
+ Math.sin(index));
Any help?
Regards
Shyam
- 10-29-2010, 11:14 AM #2
Your "for" loop only goes from 0 to numberOfSteps. Don't you mean for it to go from...sinValue1 to sinValue2 and then increment by numberOfSteps?
Sincerely, Joshua Green
Please REP if I help :)
- 10-29-2010, 12:10 PM #3
Member
- Join Date
- Oct 2010
- Posts
- 56
- Rep Power
- 0
Yeah! Thats what i meant to do. So do i just change the int index = sinValue1?
- 10-29-2010, 08:30 PM #4
- 10-31-2010, 05:19 PM #5
Member
- Join Date
- Oct 2010
- Posts
- 56
- Rep Power
- 0
Similar Threads
-
Command line argument
By denisatandi in forum New To JavaReplies: 8Last Post: 10-16-2012, 11:37 PM -
Maximum length of Command Line Argument
By balamurugan.murthy in forum Advanced JavaReplies: 11Last Post: 05-21-2010, 04:45 PM -
Command line argument help...
By arson09 in forum New To JavaReplies: 4Last Post: 05-06-2010, 05:49 PM -
Command Line Argument
By right2001 in forum New To JavaReplies: 6Last Post: 02-17-2009, 02:08 PM -
Parsing Argument Values
By vipvan2000 in forum New To JavaReplies: 1Last Post: 03-06-2008, 11:01 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks