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
kolezko [41]
3 years ago
3

Create an array of size 10 and name RandArray populate the RandArray with random integer from 1 to 20. Every element in the Rand

Array must be changed as follows: If the value of the element is less than the array index, the element must be replaced with the index plus 10. If the value of the element is equal to the index, the element must be doubled. If the value of the element is greater than the index, the element must be replaced by the index squared. Print the original number and the changed number of the RandArray
Computers and Technology
1 answer:
Sedbober [7]3 years ago
4 0

Answer:

int[]RandArray = new RandArray[10];

for(int x =0; x< RandArray.length;x++){

RandArray[x] = random.nextInt(10 - 1 + 1) + 1;

}

for(int x =0; x< RandArray.length;x++){

int og = RandArray[x];

if(RandArray[x]<x){

RandArray[x] = x + 10;

}

else if(RandArray[x] == x){

RandArray[x] =RandArray[x] * 2;

}

else if(RandArray[x] > x){

RandArray[x] =Math.pow(x,2);

}

System.out.println("Original: " + og +"New: "+ " RandArray[x])

}

Explanation:

You might be interested in
Write a program that completes the following requirements in C program:
m_a_m_a [10]

Answer:

#include<stdio.h>

#include<string.h>

int main() {

int n;

FILE *fp = fopen("salaries.txt", "r");

 

double sumSalaries = 0;

double quarterlySalary1, quarterlySalary2, quarterlySalary3, quarterlySalary4;

while(!feof(fp)) {

 

fscanf(fp, "%lf", &quarterlySalary1);

fscanf(fp, "%lf", &quarterlySalary2);

fscanf(fp, "%lf", &quarterlySalary3);

fscanf(fp, "%lf", &quarterlySalary4);

sumSalaries = sumSalaries + quarterlySalary1+quarterlySalary2+quarterlySalary3+quarterlySalary4;

printf("Salary Sum %lf: \n", sumSalaries);

printf("Income Type: ");

if(sumSalaries > 200000 ){

printf("h");

}

else if(sumSalaries >= 15000 && sumSalaries<=200000){

printf("m");

}

else{

printf("l");

}

printf("\n");

}

 

 

fclose(fp);

return 0;

}

Explanation:

4 0
4 years ago
How to jailbreak ios 9.2 ? Is there anyway???!!!!
Leviafan [203]
Use Pangu 9.2 iOS jailbreak installer.
1. get the Pagnu 9.2 installer
2. connect your iOS 9.2 device to your Windows/OS X machine via universal serial bus cord
3. go through with the setup wizard
6 0
3 years ago
April 107 90 29 31 66 0.344
Misha Larkins [42]

Answer:

Check the explanation

Explanation:

with open('stats. txt', 'r') as   # open the file in read mode

   list1 = []   # initialize an empty list

   for i in  . readlines ():  # read every line of file

       for j in i. split ():  # split each line by a space and append it to the list1

           list1. append (j)

   months = [] # initialize required lists to empty list

plate_apperence = []

at_bats = []

runs = []

hits = []

total_bats = []

for i in range(0, len(list1)-1, 7): # use a for loop and give parameters as start,stop and step count

months. append(list1[i]) # append list1 elements to required lists

plate_apperence. append(int(list1[i+1]))

at_bats. append(int(list1[i+2]))

runs. append(int(list1[i+3]))

hits. append(int(list1[i+4]))

total_bats. append(int(list1[i+5]))

for i in range(len(months)): # for each element in months

print("Player's Average Batting and slugging percent for the month ", months[i], " is as shown below")

print("{:.2f}".format(hits[i]/at_bats[i])) # calculate Average batting and slugging percent and print them

print("{:.2f}". format(total_bats[i]/at_bats[i]))

print("\n")

Kindly check the attached images below to get the Code Screenshot and Code Output.

3 0
3 years ago
Source code is one particular representation of a software system. It highlights some details and hides others. This is a good e
grigory [225]

Answer:

Abstraction

Explanation:

Under fundamental principles of software engineering, the term "abstraction" is simply defined as the act of highlighting some details and hiding other ones.

Thus, the correct answer among the options is Abstraction.

8 0
3 years ago
To change the design of a query, right-click the query in the Navigation Pane and then click ____ on the shortcut menu.
Rama09 [41]
TO change the design of a query, right click the query in the Navigation Panel and the click "Design View" on the shortcut Menu. Design view tab is where you can make changes on your current design for your presentation,
7 0
3 years ago
Other questions:
  • Determine whether the relation represents a function. If it is a​ function, state the domain and range.
    6·1 answer
  • In what order are ribbons organized? From Microsoft Word
    7·1 answer
  • What adds the element carbon to the environment
    10·2 answers
  • 1. The @ symbol is used to denote:​
    7·1 answer
  • Which of the following statements is true?
    8·2 answers
  • Fill in the blanks of the SQL Statements: Fund_Id VARCHAR(10) , Donor_id VARCHAR(10) , Count_Of_Receipts INTEGER, Total_Receipts
    15·1 answer
  • Animation timing is does not affect the
    10·1 answer
  • Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in
    13·1 answer
  • Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. T
    6·1 answer
  • A third party that provides a computer system such as Windows, programming applications, databases, and web servers is demonstra
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!