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
Arada [10]
3 years ago
11

Consider the following declaration: double[] sales = new double[50]; int j; Which of the following correctly initializes all the

components of the array sales to 10.
(i) for (j = 0; j < 49; j++) sales[j] = 10;
(ii) for (j = 1; j <= 50; j++) sales[j] = 10;
Computers and Technology
1 answer:
vlada-n [284]3 years ago
3 0

Answer:

The answer is "None of these".

Explanation:

In the given question an array "sales[]" is declared, which contains 50 double type elements, and in the next line, an integer variable j is defined, which uses a for loop. In this question two options is given, in which both are not correct, that can be described as follows:

  • In option (i), A loop is defined that, uses variable j which starts with 0 and ends with 48, So total elements are 48 that's why it is not correct.
  • In option (ii), A loop will use variable j that, starts with 1 and ends with 49, That's why it is not correct.
You might be interested in
Write a program that converts a number entered in Roman numerals to decimal. your program should consist of a class, say, Roman.
arlik [135]

Answer:

The code is given below in Java with appropriate comments

Explanation:

import java.util.*;

public class RomantoDecimal {

    public static void main(String[] args)

    {

         Scanner SC = new Scanner(System.in);

         RomantoDecimal r = new RomantoDecimal();

         System.out.println("Enter a Roman number :");

         // INPUT A ROMAN NUMBER

         String rNum = SC.next();

         // CALL convertToDecimal FOR CONVERSION OF ROMAN TO DECIMAL

         r.convertToDecimal(rNum);

    }

    // M=1000, D=500, C=100, L=50, X=10, V=5, I=1

    public void convertToDecimal(String roamNo)

    {

         int number = 0;

         // TEACK EACH DIGIT IN THE GIVEN NUMBER IN REVERSE ORDER

         for (int i = roamNo.length() - 1; i >= 0; i--)

         {

             // FIND OUT WHETHER IT IS 'M' OR NOT

             if (roamNo.charAt(i) == 'M')

             {

                  if (i != 0)

                  { // CHECK WHETHER THERE IS C BEFORE M

                       if (roamNo.charAt(i - 1) == 'C')

                       {

                            number = number + 900;

                            i--;

                            continue;

                       }

                  }

                  number = number + 1000;

             }

             // FIND OUT WHETHER IT IS 'D' OR NOT

             else if (roamNo.charAt(i) == 'D')

             {

                  if (i != 0)

                  {

                  // CHECK WHETHER THERE IS C BEFORE D

                       if (roamNo.charAt(i - 1) == 'C')

                       {

                            number = number + 400;

                            i--;

                            continue;

                       }

                 }

                  number = number + 500;

             }

            // FIND OUT WHETHER IT IS 'C' OR NOT

             else if (roamNo.charAt(i) == 'C')

             {

                  if (i != 0)

                  {

                       if (roamNo.charAt(i - 1) == 'X')

                       {

                            number = number + 90;

                            i--;

                            continue;

                      }

                  }

                  number = number + 100;

             }

             else if (roamNo.charAt(i) == 'L')

             {

                  if (i != 0)

                  {

                       if (roamNo.charAt(i) == 'X')

                       {

                            number = number + 40;

                            i--;

                            continue;

                       }

                  }

                  number = number + 50;

             }

             // FIND OUT WHETHER IT IS 'X' OR NOT

             else if (roamNo.charAt(i) == 'X')

             {

                  if (i != 0)

                  {

                       if (roamNo.charAt(i - 1) == 'I')

                       {

                            number = number + 9;

                            i--;

                            continue;

                       }

                  }

                  number = number + 10;

             }

             // FIND OUT WHETHER IT IS 'V' OR NOT

             else if (roamNo.charAt(i) == 'V')

             {

                  if (i != 0)

                  {

                       if (roamNo.charAt(i - 1) == 'I')

                       {

                            number = number + 4;

                            i--;

                            continue;

                       }

                  }

                  number = number + 5;

             }

            else // FIND OUT WHETHER IT IS 'I' OR NOT

             {

                  number = number + 1;

             }

         }// end for loop

         System.out.println("Roman number: " + roamNo + "\nIts Decimal Equivalent: " + number);

    }

}

3 0
3 years ago
Write a machine code program for all the following problems. Test to make sure that they work in LC3. It's best to complete each
Usimov [2.4K]

Answer:

Following is given the solution to each part.

All the comments are given above each step so that they can make the logic clear.

I hope it will help you!

Explanation:

8 0
3 years ago
What are chemical manufacturers required to provide to anyone who purchases or uses their chemicals for a work purpose? Select a
Julli [10]

Answer:

Labels and Safety Data Sheets.

Explanation:

Label is a short description of what is inside the container. And Safety Data Sheets has everything that is required. You have precautionary measures listed as well as the training details in the safety data sheets. The training PPE is hence not required definitely. However, the only other thing required is the label, as without that you will not come to know what is inside the container from outside. Hence, the above answer.

8 0
2 years ago
Read 2 more answers
Some systems provide file sharing by maintaining a single copy of a file. Other systems maintain several copies, one for each of
Natalka [10]

Answer:

Explanation:

When you have a single copy, a large number of concurrent updates that are supposed to go to a file may result in the user obtaining incorrect information. This incorrect information obtained them leads to the file being left in an incorrect state. When you have a lot of or multiple copies, then storage waste exist and the various copies might happen not to be consistent with respect one other. In summary, what happens is that

a) Using one copy saves space, but also the change might have an effect on all the users.

b) Using multiple copies avoids eliminates the change problem, while creating its own problems, using more space.

3 0
2 years ago
Which statement describes one of the responsibilities of a computer programmer?
galben [10]

Answer:

d i think

Explanation:

6 0
3 years ago
Other questions:
  • Fortnite anyone? i just started tdy so dont be judgiee lol
    6·2 answers
  • In his article “is google making up stupid” Nicholas Carr uses a metaphor to suggest that
    11·2 answers
  • When powering up a home network, make sure all computers and peripherals are turned on before turning on the modem/router?
    11·1 answer
  • 我对汉语的兴趣 làm đoạn văn theo đề trên​
    14·1 answer
  • How do films use camera shots?
    10·2 answers
  • ____________________________ and _________________________ are 2 positive impacts of the internet on businesses.
    14·2 answers
  • Complete the function to return the result of the conversiondef convert_distance(miles):km = miles * 1.6 # approximately 1.6 km
    13·1 answer
  • Evaluate a career in the telecommunications industry that most interests you. What about the career appeals to you?
    8·1 answer
  • WILL GIVE BRAINLIEST!!! Danielle is warehouse supervisor for a large shipping company. Most shipments need to leave the warehous
    7·1 answer
  • TASK 1. JUMBLE ME! Direction: Arrange the jumbled letters to form a word. 1. PEREAM 2. RRENT CU 3. METREMO H 4. TORSISER 5. TANC
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!