Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 Network team has different types of switches and they use specific type of switches in the distribution point data center, in hubs etc.
Question Network team has different types of switches and they use specific type of switches in the distribution point data center, in hubs etc. Each switch has a model number and port. Based on the model number and port they will classify the switches as type type and core switches. Can we help them in the classification? Our aim is to get the model number and classify the switch as type type or core switch. Model number of the switch can be in one of the following format below where X denotes an alphabet and N denotes a number XXXNNNNNNXX or XNNNNNNX or XNNNNX NNXNX Eg: WSCPS CP CLPX In the model CLPX is the model in short, is the port number and X indicates that it is stacked. Here are the rules for classification Any switch with model numbers and port count is not more than are Type switches Eg: CLP ALL Any switch with model numbers with port count more than and model numbers are Type switches. CLPT If the switches are stacked, then it is a Core switch. Stacked switches are indicated by Sand NXhere N is a number at the end. Eg:CLPX WS CPS Here are few more examples In table Model Number CLP CLPT Ports Type Type CLPX CP CU WSCPS Core Type Type CLPX Model in short Core Classification Core Function Description Complete the function classifySwitch in the editor below. The function must print the port and type of switch. classifySwitch has the following parameters: modelnumber: string Constraints If the model number is not in the specified format, print as "Invalid model number" Input Format For Custom Testing The first line contains a string, modelnumber, denoting the model number of the switch Sample Case Sample Input For Custom Testing CLP Sample Output Type Explanation All switches with port less than are Type switches. Sample Case Sample Input For Custom Testing LP Sample Output Invalid model number Explanation Model number is not in the specified formatformat
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started