Question

4. Create a method that can be used to input a string and passes the string back to where it was called.

c sharp please

0 0
Add a comment Improve this question Transcribed image text
Answer #1

public string getInput()

{

    Console.Write("Enter a string");

   

    // read complete line of input

    string str = Console.ReadLine();

   

    return str;

}

Add a comment
Know the answer?
Add Answer to:
c sharp please 4. Create a method that can be used to input a string and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Step 2: Create the method specified below. static int GetValidWidth(string prompt) Input parameters prompt: message for...

    Step 2: Create the method specified below. static int GetValidWidth(string prompt) Input parameters prompt: message for user describing the input required Returns A non-zero width entered by the user Step 3: Create the method specified below. static int GetValidHeight(string prompt) Input parameters prompt: message for user describing the input required Returns A non-zero positive height entered by the user Step 4: Create the method specified below. static void DisplayBox(int width, int height, char fillChar) Input parameters width: width of each...

  • Create a web service in c# called Continent with one web method called GetContinent. This method...

    Create a web service in c# called Continent with one web method called GetContinent. This method should take a string parameter called countryName, and should return a string containing the continent that the country is in. This web service should return hardcoded country and continent data, as follows, Country: Brazil. Continent: South America. Country: United States. Continent: North America. Country: Canada. Continent: North America. Country: Zambia. Continent: Africa. Create a web application that calls your web service. The web application...

  • C# programming 50 pts Question 2:2 1- Create the base class Book that has the following instance variables, constructor, and methods title (String) isbn (String) authors (String) publisher (Strin...

    C# programming 50 pts Question 2:2 1- Create the base class Book that has the following instance variables, constructor, and methods title (String) isbn (String) authors (String) publisher (String) edition ( int) published year (int) Constructor that takes all of the above variables as input parameters. set/get methods ToString method// that return sting representation of Book object. 2-Create the sub class New_Book that is derived from the base class Book and has the following instance variables, constructor, and methods: title...

  • Create a class called Horse. It has an instance var which is a string called "breed"...

    Create a class called Horse. It has an instance var which is a string called "breed" create a constructor to set and an a accessor method to return back the breed. Then in a main driver class, create an ArrayList with 5 Horses. Create the following static method which returns back the total horses in the ArrayList of a certain breed. public static int getBreed(List<Horse> h, String breed);

  • package week_3; /** Write a method called countUppercase that takes a String array argument. You can...

    package week_3; /** Write a method called countUppercase that takes a String array argument. You can assume that every element in the array is a one-letter String, for example String[] test = { "a", "B", "c", "D", "e"}; This method will count the number of uppercase letters from the set A through Z in the array, and return that number. So for the example array above, your method will return 2. You will need to use some Java library methods....

  • In this same program I need to create a new method called “int findItem(String[] shoppingList, String...

    In this same program I need to create a new method called “int findItem(String[] shoppingList, String item)” that takes an array of strings that is a shopping list and a string for an item name and searches through the “shoppingList” array for find if the “item” exists. If it does exist print a confirmation and return the item index. If the item does not exist in the array print a failure message and return -1. import java.util.Scanner; public class ShoppingList...

  • Write a static method called encodeString that takes a string as input and prints to the...

    Write a static method called encodeString that takes a string as input and prints to the console a word where each letter is advanced by one value. In addition, your method should return the encoded String. You may make use of the method provided below to help you. public static char encode(char x) { int current = x; current++; return (char)current; } This method takes a character and returns an "encoded" character. In other words, encode('a') will return 'b'. Your...

  • C# Code please with picture of code.Thanks! 1. Create a Main method, and create a 2D...

    C# Code please with picture of code.Thanks! 1. Create a Main method, and create a 2D integer array called data, with a size of five (5) by five (5). Ask the user to input the values for this array (Scanner’s nextInt) 2.Create a method called LongestPositiveSeries, that takes in a 2D array and finds the length of the longest continuous series of positive numbers in it. For example, if we had an array like this: 0 1 2 3 4...

  • Write a program that takes a String containing a text using the method signature String useProperGrammar(String...

    Write a program that takes a String containing a text using the method signature String useProperGrammar(String text) Your method should replace the word ‘2’ with ‘to’ and return the updated text. For example, useProperGrammar("can you go 2 the store?") should return "can you go to the store?" This method should also print out the number of grammatical errors that were fixed. For example, for useProperGrammar("back 2 back 2 back"), the method would also print: Fixed 2 grammatical errors: In the...

  • java Create a method that will be used to test an IQ. This method will receive...

    java Create a method that will be used to test an IQ. This method will receive only a String and a Random object when called, and return an int. In this method you will: create a new Scanner object, say hi to the user by name, get 2 random numbers between 0 and 49, and ask the user what the sum of the 2 numbers is. If the user is correct say "Great Job!", and then assign IQ the value...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT