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
lutik1710 [3]
3 years ago
6

Write a method named showChar. The method should accept two arguments: a reference to a String object and an integer. The intege

r argument is a character position within the String, with the first character being at position 0. When the method executes, it should display the character at that character position. The method does not return anything. Here is an example of a call to the method: showChar("New York", 2); In this call, the method will display the character w because it is in position 2. Demonstrate the method in a complete program. Sample Run java Method_showChar Enter a line of text: The elevation of Mount Everest is 29,029 feet (8,848·in·meters)↵ Enter yourindex:3 5↵ 9↵
Computers and Technology
1 answer:
matrenka [14]3 years ago
5 0

A complete program with the method ShowCar:

import java.util.Scanner; // header file

public class ShowChar

{

public static void main(String[] args)

{

String lnOfText;

int i;

Scanner input = new Scanner(System.in);

System.out.print("Enter a line of text:");

lnOfText = input.nextLine();

System.out.print(" Enter your index: ");

i = input.nextInt();

show_Char(lnOfText,i);

}

public static void show_Char(String str_a, int i)

{

System.out.print(str_a.charAt(i));

}

}

In this program, both the inputs ie. a sentence or line of text as well as the index position is obtained. A method is written to find the string at that particular position. Finally the method prints that character at the particular index.

You might be interested in
New cars come with an onboard computer that controls anti-lock brakes, air bag deployment, fuel injection, etc. the software is
nika2105 [10]
Electronic control unit (ECU)is a general term for any of a number of computer modules that receive input from sensors in your automobile and control different electrical functions

The ECM is basically an on-board computer in your car it is the most common

On-board diagnostics (OBD) is an automotive term referring to a vehicle's self-diagnostic and reporting capability. 

ABS controls anti lock breaks
6 0
4 years ago
Read 2 more answers
Write a java program to create and display unique three digit number using 1,2,3 and 4 also count how many three digit number ar
padilas [110]

Answer:

Answered below

Explanation:

Class Unique{

public static void main(String args[]){

int myArray[] = {1, 2, 3, 4};

int newArray[];

int i;. int j; int k;

for(i = 0; i < myArray.length; I++)

for(j = 0; j< myArray.length; j++)

for(k = 0; k< myArray.length; k++){

if(i != j && j!= k && i != k ){

newArray.add(myArray[i] + myArray[j] + myArray[k]);

}

}

int count = 0;

for(int m = 0; m < newArray.length; m++){

count++;

}

System.out.print(newArray, count)

}

}

5 0
3 years ago
doubleUp Write a method doubleUp that doubles the size of a list of integers by doubling-up each element in the list. Assume the
Maslowich

Answer:

The solution in Python is as follows:

class myClass:

     def doubleUp(self,myList):

           myList[:0] = myList[::2] = myList[1::2] = myList[:]

       

mylist =  [1, 3, 2, 7]

list = myClass()

list.doubleUp(mylist)

print(mylist)

Explanation:

To create a method in Python, the first step is to create a Class.

This is done in the following line:

class myClass:

Then this line defines the method

     def doubleUp(self,myList):

This line duplicates the elements of the list

           myList[:0] = myList[::2] = myList[1::2] = myList[:]

This defines the list        

mylist =  [1, 3, 2, 7]

This creates an instance of the class

list = myClass()

This passes the list to the doubleUp method

list.doubleUp(mylist)

This prints the duplicated list

print(mylist)

4 0
3 years ago
Linux is a kind of software whose code is provided for use, modification, and redistribution. what kind of software is this?
Leni [432]
<span>Linux is a type of open-source software. The entire premise of open-source code is to make it as easy for people to develop and share as possible, instead of use as a vehicle to make money. This way, the collective knowledge of the community can make the program as secure and user-friendly as possible.</span>
7 0
3 years ago
Kenny has gone to a rocky beach to take a photo of the sunset. He wants to level his shot perfectly. He is aware that his tripod
iragen [17]

Answer:

it would probably be on the right side

Explanation:

3 0
4 years ago
Read 2 more answers
Other questions:
  • The responsibilities of the IT department and the needs of the user departments may cause conflicts over A. the color of the use
    6·1 answer
  • PLS HELP ASAP! WILL GIVE BRAINLIEST!
    14·1 answer
  • Regularly Tuning up a computer can assist keeping it running at Peak speed. True or False?
    12·1 answer
  • Which of the following statements applies to a proprietary software license? a. Purchased from a vendor and gives you the right
    5·1 answer
  • Your program will read a word (or a whole line) from the user. It will then count the number of vowels in the word (or line) and
    12·1 answer
  • Kelly is a college sophomore majoring in computer science. She is interested in gaining exposure to the most useful and current
    13·1 answer
  • Go in my discord server Code is . (CebjBXN)​
    10·2 answers
  • 6.6 lesson practice edhesive quiz
    12·1 answer
  • Read the following scenario. How might Sarah correct successfully complete her task?
    6·1 answer
  • What is the computer?​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!