Requirements

1) Complete the Java CanBeDivided program.

The program reads in command line arguments which are floating-point numbers (type double) into an array of doubles (this part has already been written for you).

Your program should examine the array and determine whether it is possible to divide the numbers into two groups, such that the products of two groups of numbers are the same. Your job is to implement/write the canBeDivided method. The program will output simply true or false. You can NOT use any loop statement (for, while, do-while). It is recommended that you use a helper recursive method in your program.

Hints and additional information

1) You do not have to output how the numbers are divided. Therefore, your recursive method can return a boolean.

2) Your recursive method should not be more than 10 lines (i.e. this homework is extremely short!).

3) Your recursive method should probably accept more than 2 arguments

4) Assume there are always at least 2 command line arguments.

Sample output

1) java CanBeDivided 1.0 4.0 2.5 2.0 3.0 + 2.4

true

(Explanation: since 1.0 * 4.0 * 3.0 = 2.5 * 2.0 * 2.4)

2) java CanBeDivided 1.0 4.0 3.0

false

(Explanation: there is no way to divide the integers into 2 groups whose products are the same)

3) java CanBeDivided 15.0 2.0 1.5 5.0

true

(Explanation: since 15.0 = 2.0 * 1.5 * 5.0)

4) java CanBeDivided 3.0 2.5 9.2 6.1

false

(Explanation: there is no way to divide the integers into 2 groups whose products are the same)

Subject | Computer |

Due By (Pacific Time) | 05/01/2014 08:59 pm |

Tutor | Rating |
---|---|

pallavi Chat Now! |
out of 1971 reviews More.. |

amosmm Chat Now! |
out of 766 reviews More.. |

PhyzKyd Chat Now! |
out of 1164 reviews More.. |

rajdeep77 Chat Now! |
out of 721 reviews More.. |

sctys Chat Now! |
out of 1600 reviews More.. |

sharadgreen Chat Now! |
out of 770 reviews More.. |

topnotcher Chat Now! |
out of 766 reviews More.. |

XXXIAO Chat Now! |
out of 680 reviews More.. |