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
Harman [31]
3 years ago
5

printArray is a method that accepts one argument, an arrayof int. The method prints the contents of the array; it does not retur

n a value. inventory is an array of int that has been already declared and filled with values. Write a statementthat prints the contents of the array inventory by calling the method printArray using a declared and instantiated object named obj.
Computers and Technology
1 answer:
castortr0y [4]3 years ago
8 0

Answer:

public class ArrayTest {

   public static void main(String[] args) {

       int [ ] inventoryArray = {2,34,45,65,78,78,100};

       Array obj = new Array();

       obj.printArray(inventoryArray);

       //new Array().printArray(inventoryArray);

   }

}

class Array {

   public void printArray(int []arr) {

       for(int i =0; i<arr.length; i++){

           System.out.print(arr[i]);

           System.out.print(" ");

       }

   }

}

Explanation:

  1. Two classes are created
  2. Array and ArrayTest
  3. The class Array has the method printArray that accept an argument array and prints the contents using a for loop.
  4. In the class ArrayTest, and array is created and initialized with some values called inventoryArray.
  5. An object of the Array class is created and named obj
  6. the method printArray of the Array class is called and passed the created inventoryArray. This prints the values to the screen
You might be interested in
Create a class Str that subclasses str. Add a method to the subclass that checks if the string does not start with a given strin
Stolb23 [73]

Answer:

#include <iostream>

using namespace std;

class Str{  ///baseclass

   public :

   string super_str;

   string getStr()

   {

       return super_str;

   }

   void setStr(string String)

   {

       super_str=String;

   }

};

class str : public Str{   //inheriting Str publicly

   public :

       string sub_str;

       string getstr()

       {

           return sub_str;

       }

       void setstr(string String)

       {

           sub_str=String;

       }

       bool notstartswith()

       {

           int n=sub_str.length();   //to find length of substr

           bool flag=false;

           for(int i=0;i<n;i++)     //Loop to check beginning of Str

           {

               if(super_str[i]!=sub_str[i])

               {

                   flag=true;

                   break;

               }

           }

           return flag;

       }

};

int main()

{

   str s;    //object of subclass

   s.setStr("Helloworld");  

   s.setstr("Hey");

   if(s.notstartswith()==1)     //checking if str is substring of Str

       cout<<"Str does not start with str";

   else

       cout<<"Str starts with str";

   return 0;

}

OUTPUT :

Str does not start with str

Explanation:

Above program is implemented the way as mentioned. for loop is being used to check the beginning of the str starts with substring or not.

3 0
4 years ago
Match the cell reference to its definition
Alisiya [41]

Answer:

which cell reference:-|

6 0
3 years ago
Read 2 more answers
What technology gets its name from the notion that it ignores the traditional A, B, and C class designations for IP addresses?
goblinko [34]

Answer:

Classless Inter-Domain Routing

Explanation:

Classless Inter-Domain Routing (CIDR), pronounced “cider” or “sidder,” gets its name from the notion that it ignores the traditional A, B, and C class designations for IPv4 addresses and sets the network-host ID boundary wherever it wants to, in a way that simplifies routing across the resulting IP address spaces.

3 0
3 years ago
Which generation is called the new silent generation? A. Generation X B. the homelander generation C. the millennial generation
____ [38]

Which generation is called the new silent generation?

A. Generation X

<u>B. the homelander generation </u>

C. the millennial generation

D. the boom generation

6 0
3 years ago
_______ is the remote performance of medical exams, consultations, health monitoring and analysis using special medical equipmen
laila [671]

Answer:

eHealth.

Explanation:

eHealth or electronic health is a digital medical platform used to connect individuals to medical treatment they so need but can not receive due to certain barriers.

The eHealth platform uses modern day technology for consultation, examination of patient's health, prescription of medication etc. But it refers patients to trusted medical facilities when the situation is critical.

All these are done electronically through the internet and has eliminated the boundaries of geographical location.

8 0
4 years ago
Other questions:
  • What occurs in a steam engine?
    5·2 answers
  • Define a function CoordTransform() that transforms its first two input parameters xVal and yVal into two output parameters xValN
    7·2 answers
  • What are the advantages and disadvantages of malware maintenance?
    12·1 answer
  • As a member of the accounting group,
    10·1 answer
  • How do you freeze the total cell so that it doesn't change when copied?
    6·1 answer
  • What Is the Purpose of a Web Browser? *<br><br>​
    7·2 answers
  • what will happen to the contents of the destination ell if you copy the contents of the source cell into the destination cell
    7·1 answer
  • Binary is best interpreted by a computer because ​
    12·2 answers
  • I need the solution to this task please anyone
    14·1 answer
  • List and describe four services that comprise IT infrastructure, beyond physical devices and software applications.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!