1. Engineering
  2. Computer Science
  3. ask the user to input a string and a number...

Question: ask the user to input a string and a number...

Question details

ask the user to input a string and a number, separated by a single space (e.g.aaacbbb 4)- Split this string into its 2 components, resulting in 2 strings, using a String[] array.- convert the second string to an int, storing it in a variable num1.- In a try-catch block,validate that (1) there are exactly 2 components in your String[] array, and (2) confirm 2 divided by num1 does not yield an error.- If there is no error, check whether your string contains 1 and only 1 ‘c’, then check whether the first part of your string (before the c) contains only a's, and the second part of your string contains only b's. Alert the user of the conclusion (print yes or no

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution