Hello! I'm in an introductory programming class for Java, and admittedly kinda lost. I was recently assigned the following project:
Create the class DataStore. This class will store and perform calculations on user entered data.
Use commenting to provide a general description of the class, including your name, section, assignment number, and the due date. Following, use commenting to describe the logic behind important elements of the class.
Here are the details of the class:
Two properties of type ArrayList will be used to store a list of String and Integer values. Recall our principles of encapsulation, these will be our only properties. Any other variables you need will be encapsulated (declared and used) within an individual method.
You will provide a method menu(), which will print a menu of operations, allowing the user to make a selection, and continue to cycle until the user selects the quit operation. Menu operations are: to add a String and Integer value to the lists (each time this option is selected a single String and a single Integer will be added), print the String and Integer values one per line, and print the Integer value multiplied by the index position of the Integer within the list (start your index counting at zero, so the first position will have its value multiplied by zero)
Other structural elements the class will contain:
Our standard list of methods.
The method addStringAndInteger().
The method printMultiplications().
The method printInfo().
Sample Output
Welcome to the Data Store
(1) Add a String and Integer
(2) Print All Information
(3) Print Multiplications
(4) Quit
Selection: 2
All Information Stored
String Integer
(1) Add a String and Integer
(2) Print All Information
(3) Print Multiplications
(4) Quit
Selection: 1
Enter a String Value: First Entry
Enter a Integer Value: 123
(1) Add a String and Integer
(2) Print All Information
(3) Print Multiplications
(4) Quit
Selection: 1
Enter a String Value: Second
Enter a Integer Value: 213
(1) Add a String and Integer
(2) Print All Information
(3) Print Multiplications
(4) Quit
Selection: 1
// ... repeat entering values
(1) Add a String and Integer
(2) Print All Information
(3) Print Multiplications
(4) Quit
Selection: 2
All Information Stored
String Integer
First Entry 123
Second 213
//...
(1) Add a String and Integer
(2) Print All Information
(3) Print Multiplications
(4) Quit
Selection: 3
Multiplications
0 * 123 = 0
1 * 213 = 213
//...
(1) Add a String and Integer
(2) Print All Information
(3) Print Multiplications
(4) Quit
Selection: // ... continue to perform operations
(1) Add a String and Integer
(2) Print All Information
(3) Print Multiplications
(4) Quit
Selection: 4
Thank you for using the Data Store.
I can tell that the solution requires a loop that will only keep running as long as (int selection != 4), but to be honest that's all I can really figure out atm and the more research I do the more confused I get. I don't expect anybody to do my hw for me, but any advice you have would be greatly appreciated! Thank you, my professor looks like Craig T. Nelson.