Answered step by step
Verified Expert Solution
Question
1 Approved Answer
import java.io . IOException; import java.util.List; public class MasterControl { static ScannerWrapper scannerWrapper = ScannerWrapper.getInstance ( ) ; static SystemWrapper systemWrapper = SystemWrapper.getInstance ( )
import java.ioIOException;
import java.util.List;
public class MasterControl
static ScannerWrapper scannerWrapper ScannerWrapper.getInstance;
static SystemWrapper systemWrapper SystemWrapper.getInstance;
List read null;
public static void mainString args
MasterControl masterControl new MasterControl;
try
masterControl.startscannerWrapper systemWrapper;
catch IOException e
throw new RuntimeExceptione;
public void startScannerWrapper scannerWrapper, SystemWrapper systemWrapper
Input input;
Output output;
try
System.out.printlnEnter to read from console or to read from file:";
int choice Integer.parseIntSystemconsolereadLine;
if choice
input new InputFromConsole;
else if choice
input new InputFromFile;
else
throw new IllegalArgumentExceptionInvalid choice";
CircularShifter circularShifter new CircularShifter;
Alphabetizer alphabetizer new Alphabetizer;
System.out.printlnEnter to write to console or to write to file:";
choice Integer.parseIntSystemconsolereadLine;
if choice
output new OutputToConsoleMasterControlsystemWrapper;
else if choice
output new OutputToFile;
else
throw new IllegalArgumentExceptionInvalid choice";
read input.read;
List shift circularShifter.shiftLinesread;
List sort alphabetizer.sortshift;
output.writesort;
catch IOException e
eprintStackTrace;
C:UsersslashIdeaProjectsWeek srcmainjavaMasterControljava::
java: exception java.ioIOException is never thrown in body of corresponding try statement
C:UsersslashIdeaProjectsWeek srcmainjavaMasterControljava::
java: exception java.ioIOException is never thrown in body of corresponding try statement
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