Results 1 to 7 of 7
Thread: Need help with constructing code
- 05-09-2008, 01:30 AM #1
Member
- Join Date
- May 2008
- Posts
- 4
- Rep Power
- 0
Need help with constructing code
i need to design and implement an application that reads an integer value and prints the sum of all even intergers between 2 and the input value, inclusive. i also want to print an error message if the input value is less than 2 and i want to promt the user accordingly.
Any help will be greatly appreciated THANKS. =)
- 05-09-2008, 01:38 AM #2
Member
- Join Date
- May 2008
- Posts
- 4
- Rep Power
- 0
Also i need to know where to find the toolkits. This is an assignment for school and i downloaded ecplise, but cannot find toolkits so i can use keyboardreader, and this is what i have so far i dont know how to finish it
Java Code:public class Projects { public static void main(String[] args) { KeyboardReader temp = new KeyboardReader(); double V; List<Double> valueList = new ArrayList<Double>(); // You can store the values in here While (V = temp.readdouble("Enter a Value of 2 or more: ") ); { if (V >2){ valueList.add(V); // just added the value to a list } else { System.out.println("Value must be of 2 or more, Please restart the program!!"); } } } }
- 05-09-2008, 01:42 AM #3
Try to test the code.Java Code:int evennumbers = 0,total=0; int input = new java.util.Scanner(System.in).nextInt(); while(evennumbers < input){ total += (evennumbers += 2); }
You can add if statement to ensure that the user inputs 2 or more....
You can play with JOptionPane.Last edited by sukatoa; 05-09-2008 at 01:46 AM.
freedom exists in the world of ideas
- 05-09-2008, 01:46 AM #4
Member
- Join Date
- May 2008
- Posts
- 4
- Rep Power
- 0
You want me to include that into my code or do it separately? And do you know where to find the toolkits at?
- 05-09-2008, 01:52 AM #5
Ofcourse, how will you realize if you just watch it and not by testing from it....
And also, i like to confirm if that was what you like to implement.
What toolkit are you looking for? What should be the use of that?
Im not an eclipse user. But many are using eclipse here...freedom exists in the world of ideas
- 05-09-2008, 01:55 AM #6
Member
- Join Date
- May 2008
- Posts
- 4
- Rep Power
- 0
haha, well we use that in my school. i forgot to bring a copy of took kits on my flash drive. I need the toolkits that have the keyboard reader, math, and all that.. i dont know if you could help me with that lol
- 05-09-2008, 02:14 AM #7
Similar Threads
-
I need help fixing my code.. or non code?
By MrHuggykins in forum New To JavaReplies: 1Last Post: 03-19-2008, 10:12 PM -
Pls some one to help mi wit this code
By _nik_ in forum New To JavaReplies: 3Last Post: 02-10-2008, 02:02 AM -
code help
By chitwood in forum New To JavaReplies: 0Last Post: 02-10-2008, 12:08 AM -
help with oop code
By nhlfan in forum New To JavaReplies: 1Last Post: 11-27-2007, 08:21 PM -
Generating Code Automatically Using Custom code Template In Eclipse
By JavaForums in forum EclipseReplies: 1Last Post: 04-26-2007, 03:52 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks