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
lina2011 [118]
4 years ago
13

(Java) I need help understanding what to code for these methods.

Computers and Technology
1 answer:
Nuetrik [128]4 years ago
7 0

Answer:

public Mysring(char[] Original)

{

        int size= Original.length();

       for(int i=0;i<=size;i++)

       {

           arr[i]=Original[i];

       }

}

Public Mystring(String Original)

{

  char[] arr=String.toCharArray();

}

Public Mystring(Mystring Original)

{

   Int len=Original.arr.length();

   for(int i=0;i<=len;i++)

   {

        arr[i]=Orginal.arr[i];

   }

}

public int length()

{

    Int len=arr.length();

   return len;

}

Public char charAt(int index)

{

     try

     {

      System.out.println(arr[index]);

     }

     catch(IndexOutOfBoundsException ex)

     {

          throw ex;

     }

}

   

}

Explanation:

1) The first one is the Parameterized constructor. It takes an array of character as input, and assigns it to the array of character which is a field in the given class MyString.

2) The second one is also the Parameterized constructor, and it takes a string as input, and converts it to an array of characters, and finally assigns it to the character type field of the class MyString.

3) The third one is the copy constructor, and takes a previous object of the class as input, and assigns its values to the new instance of the class.

4) The fourth function returns the length of the character field of the class MyString.

5) The fifth function returns the character in the character field at the given index. And if Index is more than the length of the arr field, it through the IndexOutOfBoundsException.

You might be interested in
According to the video, what is used to create computer programs?
Lena [83]
Its a or b. znskdbxkdb
8 0
3 years ago
Read 2 more answers
4. What is the difference between head tag and heading tag?​
Vedmedyk [2.9K]
Answer 515be559d883f8eab00011e5
head is the tag at the top of your page containing your meta-tags, styles, scripts and title. headings are the h1, h2, h3 etc tags that allow you to size your text. a is an anker usable in the url for navigating to other pages or as in-page navigation.
4 0
3 years ago
Identify two entities and 2 of their attributes from the given scenario.
polet [3.4K]

Bookstore and BookSearch are the two entities for the given scenario.

Explanation:

  • For the given Book.com virtual store, there can be two entities like Bookstore and BookSearch.
  • Bookstore can have all the details of the books in the virtual store. hence the attributes can be
  • Bookstore attributes: bookname, Authorname, Publisher, Publishedyear, Agegroup, category.
  • BookSearch entity can be used to search the books in the virtual store.
  • Booksearch attributes: bookname, category, bookid, authorname.
8 0
4 years ago
Which of the following declares an abstract method in an abstract C++ class? (Points : 2) public: void print();
Dahasolnce [82]

Answer:

public: virtual void print()=0;

Explanation:

An abstract class contains a pure virtual function. Pure virtual class cannot be instantiated but it can be subclassed and the subclass can provide an implementation of the function.

A virtual function declaration in the class is preceded by the virtual keyword. For example, virtual void print();

A pure virtual function declaration is followed by '=0;'

public: virtual void print()=0;

4 0
4 years ago
Every workplace should have an emergency plan of action.
pochemuha

Answer:

yes i agree with that the answer is in fact true

Explanation:

follow my in sta gram at grac.ehihi

6 0
3 years ago
Read 2 more answers
Other questions:
  • Blogs are typically written by large companies or organizations as a way to express formal, technical, or scholarly information
    5·2 answers
  • Fill the validateForm function to check that the phone number contains a number (use the isNaN function) and that the user name
    10·1 answer
  • Csc105 final graded project
    9·1 answer
  • Assume that you have created a class named DemoCar. Within the Main() method of this class, you instantiate a Car object named m
    12·1 answer
  • Select the correct answer from each drop-down menu.
    8·1 answer
  • Write a program that asks the user to enter two integer numbers X and Y. The program halves each number between X and Y then pri
    15·1 answer
  • In Subtractive empathy, the counselor responses gives back less (or distorts) than what the client has said. slightly add someth
    14·1 answer
  • Answer any one: write a computer program:which you know.​
    6·1 answer
  • Question #2: How would you demonstrate professionalism in a video call with a teacher? Edmentum Digital world Please Help!!
    8·1 answer
  • Please select the word from the list that best fits the definition<br><br> Plagiarism
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!