Question: using java 1) Insert an element at desired location Take the following inputs from a user:- a) Element: e.g. PQRS b) Desired Location(1-5): e.g. 4
1) Insert an element at desired location Take the following inputs from a user:- a) Element: e.g. "PQRS" b) Desired Location(1-5): e.g. 4 Create a List with the following values:- "OOne",, ,"Three", 67.986,Z ', "ABC", 123,true, "xyz" } The 'Desired Location' should only be between 1-5. Any other input should give the following error to the user "Only values between 1-5 are allowed, please try again. and the prompt should be redisplayed to the user. 'Element' can be any type of the following elements: a) Boolean - If Boolean reverse the value and then add, i.e. if true you add false to the list. b) Character - if character, you add the next character to the list i.e. if ' C ' you add ' D '... if ' c ' you add 'd' to the list. c) String - Change the case of string before adding to the list. d) Float / Double Add 2.0 before adding to the list. e) Integer - Add 1 before adding to the list. Upon successful addition of an element:- a) Redisplay all the elements of the list on the console. b) Return the prompt back to the user so he can enter another element. When the user types ' H ' on the console, terminate the program. Use List for implementation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
