1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lapo4ka [179]
3 years ago
11

Write a java program that declares an array "alpha" of 50 elements of type "double". Initialize the array so that the first 25 e

lements are equal to the square of the index variable and the last 25 elements are equal to three times the index variable. Output the array so that 10 elements per line are printed
Computers and Technology
1 answer:
Mars2501 [29]3 years ago
5 0

Answer:

Here is code in java.

import java.util.*;

class Number

{   //main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

       // create an array of size 50 of double type

       double[] alpha = new double[50];

        //initialize array

       for(int x = 0; x< 50; x++)

               {

               if(x<25)

               {

                   alpha[x]= x * x;

               }

               else

               {

                   alpha[x]= 3 * x;

               }

            }

            //print 10 elements per line

            for(int y=1;y<=50;y++)

            {

                System.out.print(alpha[y-1] +" ");

                if(y%10==0)

                {

                    System.out.println();

                }

            }

   }catch(Exception ex){

       return;}

}

}

Explanation:

Create an array size 50 of double type.initialize first 25 elements as square

of the index variable and rest 25 as three times the index variable.Then print

the elements of array using for loop, if there is 10 elements in a line then

print a newline.

Output:

0.0 1.0 4.0 9.0 16.0 25.0 36.0 49.0 64.0 81.0

100.0 121.0 144.0 169.0 196.0 225.0 256.0 289.0 324.0 361.0

400.0 441.0 484.0 529.0 576.0 75.0 78.0 81.0 84.0 87.0

90.0 93.0 96.0 99.0 102.0 105.0 108.0 111.0 114.0 117.0

120.0 123.0 126.0 129.0 132.0 135.0 138.0 141.0 144.0 147.0

You might be interested in
It is appropriate to leave sections of an application blank ?<br><br><br><br> True or False
sergiy2304 [10]

false because if you leave them blank then ther will be no use to add them in the first

3 0
3 years ago
How many people did you help today
Rashid [163]

Answer:

red

Explanation:

6 0
3 years ago
Read 2 more answers
How to create a trace table
TEA [102]

Answer:

To create table g

Go to insert tab

Choose Table option at left corner and measure the table box.

Table is created in Microsoft.

7 0
3 years ago
A Portable Document Format (PDF) can be opened with Adobe Acrobat Reader and many web browsers.
natka813 [3]

Answer:

True

Definition / Directions:

A PDF is a file format that provides an electronic image of text or text and graphics that looks like a printed document and can be viewed, printed, and electronically transmitted.

How to Open a PDF:

Open the Adobe Reader or any other PDF software program. Then, click the file menu near the top on the left side of the window, select Open, and browse to the location of the PDF file. Select the file you want to open by clicking the file name, and then click the Open button to open the file.

6 0
3 years ago
Events and conditions that happen within an organization that are somewhat easier to deal with when responding to change are cal
IgorC [24]
These are called abstractions. They can be created by functions, if statements, or on event structures.
3 0
3 years ago
Other questions:
  • In database systems, the dbms enforces rules about which user can perform which action when. The rules are known as ________.
    10·1 answer
  • Which of the following has likely attended vocational school?
    10·1 answer
  • Which of the following techniques has to do with how the people who make the commercial manipulate the way it looks?
    8·1 answer
  • What does a column represent in a chart?
    13·1 answer
  • A RAID structure ____. is primarily used for security reasons is primarily used to ensure higher data reliability stands for red
    14·1 answer
  • Assume the availability of an existing class, ICalculator, that models an integer arithmetic calculator and contains:an instance
    12·1 answer
  • How much memory will be occupied by black and white image​
    8·2 answers
  • The special operator used to check for similar character strings is ____.
    13·1 answer
  • At one college, the tuition for a full-time student is $6,000 per semester. It has been announced that the tuition will increase
    7·1 answer
  • Project: Design and Development Research Project
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!