Starting from:

$9

Sum and Product--program logic

. Create the logic for a program that continuously prompts a user for a numeric value until the user enters 0. 2. The application passes the value in turn to a method that computes the sum of all the whole numbers from 1 up to and including the entered number. Example if the number entered is 4 the displayed value would be 10 (1+2+3+4). 3. Also to a method that computes the product of all the whole numbers up to and including the entered number. Example if the number entered is 4 the displayed value would be 24 (1*2*3*4). ************************************************************************************************************************** / SumAndProduct.java - This program computes sums and products. // Input: Interactive. // Output: Computed sum and product. import javax.swing.*; public class SumAndProduct { public static void main(String args[]) { int number; String numberString; numberString = JOptionPane.showInputDialog("Enter a positive integer or 0 to quit: "); number = Integer.parseInt(numberString); while(number != 0) { // call sums() method here // call products() method here xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

More products