Reference no: EM13246501
Write a program cmsc401.java that receives a sequence of commands (from 1 up to 10000 commands)
a command can be one of:
1 - an insert – add the date and city to “gig plan”
2 - a ‘date’ query – check if there’s a gig planned at a certain
date (and if yes, which city)
3 - a ‘next gig’ query – for the gig found using most recent
“command 2”, check when and where the next performance is
4 – end of sequence of commands, quit the program the sequence of commands always ends with Command 4 Command 3 always is preceded immediately by Command 2 Command 3 is given only if Command 2 returned data & city (that is, there was a gig planed at a queried date) the sequence of commands is presented at standard input,
each line is a new command
format of the commands and responses to them:
1 - insert a gig,
input format is “1 YYYYMMDD STRING”, no output
YYYYMMDD represents the date – date can by anything in the 21st century
STRING represents the city and is up to 10 characters in length
2 – a ‘date’ query,
input format is “2 YYYYMMDD”,
output format is “YYYYMMDD STRING” if there is a gig on that date, or
“YYYYMMDD NO GIG” if not
3 – a ‘next gig’ query
input format is “3”
output format is data and place of next gig: “YYYYMMDD STRING”,
or “NO NEXT GIG” if there’s no next gig in database
4 – quit
input format is “4”, no output, program exits
? Use Standard I/O to read input and write the result
? In Java, it’s System.in for input, System.out for output
Implement the database as a tree
Only implement the required functionality from the tree Using existing tree code (e.g. Built into Java) is NOT allowed Remember that the state of the database changes with each insert, and queries correspond to the current state of the database
Only inserts that happened prior to the query count Inserts will never use the same date more than once There is only one correct result for each query As always: no other text, comments, questions, prompts should be printed on standard output
Prepare the source code as cmsc401.java Put your name, and a short description of your approach (including which tree operations are used for each command) as a comment at the start of the cmsc401.java
Linear regression analyzing total overhead cost
: Discuss company overhead you determine that the majority of your indirect costs are related to four primary activities and linear regression analyzing total overhead cost and units sold and linear regression analyzing total overhead cost and machine ..
|
Which countrys govt is more heavily involved in economy
: Governments of country A and country B spend the same amounteach year. Spending on functions relating to dealing with marketexternalities and public goods accounts for 25 percent ofgovernment expenditures in country A
|
Explain ammonia is produced by the reaction of hydrogen
: Ammonia is produced by the reaction of hydrogen and nitrogen N2(g)+3H2(g)--->2NH3(g). a) How many moles of H2 are needed to react with 1.0 mol of N2? b) How many moles of N2 reacted if 0.60 mol of NH3 is produced?
|
Was everyone eligible for citizenship in ancient greece
: Was everyone eligible for citizenship in Ancient Greece? If not, who was excluded? Would Ancient Greece still be considered a democracy today?
|
Write a program cmsc401 java
: Write a program cmsc401.java that receives a sequence of commands (from 1 up to 10000 commands)
|
Find the torque on the loop
: A 10cm diameter circular wire loop carries a current of 2.4A, Find the torque on the loop in a 1.2T magnetic field directed perpendicular to the loop
|
Explain copper has two naturally occurring isotopes
: Copper has two naturally occurring isotopes. Cu-63 has a mass of 62.939 amu and relative abundance of 69.17%. Use the atomic weight of copper to determine the mass of the other copper isotope. Express your answer using four significant figures
|
What is scc the monthly operating income advantage
: The Production Division has no alternative use for the facilities used to manufacture the stuffing. What is SCC's the monthly operating income advantage (disadvantage) if the goods are purchased internally?
|
What are some of the reason why mergers happen
: In many industries, such as supermarkets, banks, cell phonecompanies, etc., because of mergers our choices as consumers are reduced to two or three competitors. Do you think thisis good for the economy
|