Ive been having problems with this assignment. I do not know where to start. Any
ID: 3536079 • Letter: I
Question
Ive been having problems with this assignment. I do not know where to start. Any help is appreciated. Thank you.
Consider a class called Configuration. This class “encapsulates†the configuration management
for any software system. For example, once created, the user can simply ask the configuration
object for value(s) to a certain configuration key. Let’s take a look at a few examples:
String filename = “config.txtâ€;
Configuration config = new Configuration( new File(filename) );
int numUser = config.getInteger( “num_users†);
String name = config.getString( “player1†);
In the above example, the config object is constructed and its contents are expressed in the file
config.txt. The format of the config.txt file is as followed.
key = value
key2 = value2
## lines with comments begins with the #
The complete Configuration class should implement the following methods:
Class Configuration {
// constructors
Configuration() { … }
Configuration( File file) { … }
Configuration(String filename) { … }
// accessors
int getSize() { … }
String getString( String key ) { … }
int getInteger( String key ) { … }
String[] getKeys() { … } // return all keys
// mutators
void push(String key, String value) { }
String[] pop() { } // returns String array[] = { key, value }
}
Your Configuration class will have two sub classes: (1) ConfigurationQueue and (2)
ConfigurationStack. The push and pop functions will behave differently depending on whether
your class is a Queue or a Stack.
Your App class is given and you should not change this class at all. Your homework will require
creating three files: Configuration.java ConfigurationQueue.java and ConfigurationStack.java.
Explanation / Answer
here is your answer
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.