Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program that declares an array of 50 components of type double. Assign values to the array so that the first 25 components

Write a Java program that declares an array of 50 components of type double. Assign values to the array so that the first 25 components are equal to the square of the index variable (the position that element will occupy), and the last 25 components are equal to three times the index variable. Output the array so that 10 elements per line are printed.

An example of the program output is shown below:

 0    1    4    9   16   25   36   49   64   81  100  121  144  169 196  225  256  289  324  361  400  441  484  529 576   75   78   81   84   87  90   93   96   99  102  105  108  111  114  117  120  123  126  129 132  135  138  141  144  147

The class name must be ArrayAssignment.

Step by Step Solution

3.38 Rating (160 Votes )

There are 3 Steps involved in it

Step: 1

Heres a simple Java program that meets your requirements public class ArrayAssig... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions

Question

1. Describe the key elements of Disneyland guest service.

Answered: 1 week ago