Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create the public class Module1 with the following data fields and methods: 1) Data fields: a. an object of type Scanner named sc (you
Create the public class Module1 with the following data fields and methods: 1) Data fields: a. an object of type Scanner named sc (you can import the Scanner class from java.util. Scanner) b. three String named input, file, and extension 2) Methods: a. a constructor method that: creates the Module1 object's Scanner object (sc) by calling Scanner's constructor method with the System.in argument to read console input b. A main method (ie., with the header public static void main(String[] args)) that, in order: Creates a new Module1 object named m by calling Module1's constructor method . Prints the message "beginning application to the console Prints a message to the console (use System.out.printin0) asking the user to enter a filename with the format "[filename]. [extension]" Reads the user input using the Scanner object's nextLine() method and assigns the String it returns to the Module1 object's input field Prints a message confirming the user's input: Displays the substring before the period with the label "filename: " Displays the substring after the period with the label "extension: " Prints the message "ending application" to the console Additional Constraints Other than Module1's main method, all data fields & methods should be for individual objects, not the entire class. Comments should be provided at the start of the file (i.e., above the class definition) giving the class author's name and the date the program was finished.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Heres the Java code for the Module1 class with explanations Java Author Your Name replace with your name Date 20230520 replace with the date you compl...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