Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The DoFunFormulas class should implement a main method that does the following: 1) Instantiates an object of type FunFormulas (that is, creates an object of
The DoFunFormulas class should implement a main method that does the following: 1) Instantiates an object of type FunFormulas (that is, creates an object of type FunFormulas). 2) Checks to make sure that one string is passed into the main method via the command line when the main method in the DoFunFormulas class is executed. If a string is not passed into the main method via the command line, the main method should print an error and exit 3) If one string is present in the String array passed as a parameter to the main method, the program should call the method to calculate the formula specified by the string passed in via the command line (that is, one of the five methods to compute formulas implemented in the FunFormulas class: sd, 1s, wi, dt, or sa) NOTE: If the argument entered on the command line does not exactly match the name of one of the methods implemented in the FunFormulas class, your program should print out an error and exit. For example, below are example runs of our solution consisting of the DoFunFormulas and FunFormulas classes (User input is in BOLD font): \$ java DoFunFormulas DD ERROR: Formula DD is not recognized, Type: sd compute storm distance is to compute distance to lightning strike wi to compute weight of ice cube dt to computer distance traveled sa to compute skin area \$ java DoFunFormulas ERROR: 1 command line argument required: Two letter name of function to compute. Type: sd compute storm distance ls to compute distance to lightning strike wi to compute weight of ice cube dt to computer distance traveled sa to compute skin area \$ java DoFunFormulas sd Enter diameter of storm in miles: 20 5 The storm will last: 6.085806194501846 hours
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