Class named module2 containing the following data members


This is an assignment I have for my intro to programming class for java. This is done through the eclipse program. I need help. Thanks!. I already made the class named Module 2 and made the data members. I am in step 2 where i need to make methods.

Class named Module2 containing the following data members and methods (note that all data members and methods are for objects unless specified as being for the entire class)

1) Data members:

a. A Scanner object named reader (your class will need to import the Scanner class)

b. A String object named inputString

c. Two int variables named startIndex and endIndex

2) Methods:

a. A Module2 constructor method that initializes reader to nullinputString to "" (an empty String), and startIndex and endIndex to -1.

b. A main method that, in order:

  • Creates a new Module2 object using the constructor from a)
  • Prints the text "starting application" to the console
  • Calls method c) with the argument "Please enter your name" and prints its returned String to the console
  • Calls method d) with the argument "Please enter a starting index value" and prints its returned String to the console
  • Calls method e) with the argument "Please enter an ending index value" and prints its returned String to the console
  • Prints the text "ending application" to the console

c. A method named getInputString that accepts a String parameter, prints the parameter String to the console, accepts a user-entered String via the console (use Scanner.nextLine()), sets the object's inputString to match the input and returns (as a String) the text "Thank you."

d. A method named getInputStart that accepts a String parameter, prints the parameter String to the console, accepts a user-entered int via the console (use Scanner.nextInt()), sets the object's startIndex to match the input and returns (as a String) the text "Thank you."

e. A method named getInputEnd that accepts a String parameter, prints the parameter String to the console, accepts a user-entered int via the console (use Scanner.nextInt()), sets the object's endIndex to match the input and returns (as a String) the text "Thank you. The substring between the two indices is " concatenated with inputString.substring(startIndex, endIndex).

Solution Preview :

Prepared by a verified Expert
Business Management: Class named module2 containing the following data members
Reference No:- TGS02672304

Now Priced at $30 (50% Discount)

Recommended (92%)

Rated (4.4/5)