Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java 1 help For this assignment you will be working with arrays. Open a new Java file called Nums.java Prompt a user to enter in
Java 1 help
- For this assignment you will be working with arrays.
- Open a new Java file called Nums.java
- Prompt a user to enter in the size of the array (the number of numbers).
- Next, using a for loop, prompt the user to enter that many numbers, and store each one in your array until your array is at full capacity.
- Using the same, or a second, for loop, sum the numbers and report their sum to the user.
- Also, multiply the numbers together and report their product to the user.
- The sum and the product should be printed to one decimal value only.
- Your program should work identically to the sample output below:
Enter the number of numbers: 4 Enter 4 numbers: Number 1: 3.2 Number 2: 6.7 Number 3: 2.9 Number 4: 4.6 The sum of the numbers is: 17.4 And the product is: 286.0
- Another run of the program might give the following output:
Enter the number of numbers: 8 Enter 8 numbers: Number 1: 2.1 Number 2: -5.6 Number 3: 9.0 Number 4: 8.7 Number 5: -2.2 Number 6: 8.2 Number 7: 9.5 Number 8: 1.4 The sum of the numbers is: 31.1 And the product is: 220931.3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started