Mini-project 1: Basic Command Line Interface
Instructions
The purpose of this mini-project is to acquaint you with Java and using the command line with Java.
Create a module called
MP1. In MP1, create a class called MP1
(which should be in
a Java file called MP1.java) with a main method (so it is runnable from
the command line, either in a terminal or in IntelliJ). Your class should have
three other methods:
readName
should prompt the user to read in a name and then save it to MP1's data membername
displayName
should display the name stored in MP1's data membername
if one was read in, otherwise print a message that says that no name was read in yetdisplayOddNumbers
should ask the user for a start and end value, then print out all of the odd numbers in that range
main
should interact with the user to decide which of these three
methods to invoke (e.g., "Which method would you like: [r]ead name,
[d]isplay name, d[i]splay odd numbers, or [q]uit?") and invoke the proper
method. An option to quit should be given, and if/when selected by the user, the
program should exit (System.exit(0)
).
Submission
Create a JAR file for MP1. See this page for the rubric. See the Canvas page to upload your submission.
(Back to top)