[Solved] SOLVED: Sum and Productprogram logic

$25

File Name: SOLVED:_Sum_and_Productprogram_logic.zip
File Size: 339.12 KB

SKU: [Solved] SOLVED: Sum and Product–program logic Category: Tag:
5/5 - (1 vote)

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

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED: Sum and Productprogram logic
$25