Write a program cmsc401 java

Assignment Help JAVA Programming
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

Reference no: EM13246501

Questions Cloud

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

Reviews

Write a Review

JAVA Programming Questions & Answers

  Button to increase or decrease the number of the balls

Simulates a bouncing ball. Extend to allow mulitple balls. You can use the +I or -I button to increase or decrease the number of the balls and use teh Suspend and Resume buttoms to freeze the balls or resume bouncing. For each ball, assign a random c..

  Graphical application for computing statistics

Write a graphical application for computing statistics of a data set. Supply a text field and button for adding floating-point values, and display the current minimum, maximum, and average in a label.

  Determine the java application on web

Determine the Java application on Web and explain how program structure functions. Explain the application in as much detail as possible.

  Client class to test implementation of the vector class

Write a client class to test your implementation of the Vector3D class thatyou implemented. Name the package in which this class is defined (projectname) vector3dapp.

  Own file to test your program

Create your own file to test your program. Your job is to set up the input and output files to have the program read from a file and write to a file. Here is a basic program that will accomplish what is desired

  Create a calculator function

This is the code for my trip planner,you need to figure out how to create a calculator function to enable users to calculate their own costs if they choose

  Generates a random number between 1 and 100

Write a program that generates a random number between 1 and 100 (inclusive) and then prompts the user to guess the number. The user should be given up to 10 chances to guess the number.

  Write java program to find calories-conditional operator

Write down the answer for this program? Write down Java program (use Conditional (? Operator) which suggests number of calories a person must eat each day.

  Returns the object with the largest measure

public static Measurable maximum(Measurable[] objects)that returns the object with the largest measure. Use that method to determine the country with the largest area from an array of

  Construct java program named collegelist

Construct a set of classes for a college to use in many student service and personnel applications. Classes you require to design include following:

  Die class that can hold an integer

Design a die class that can hold an integer from 1 to 6. use the dice class to create a dice game. in this game, the user chooses a number between 2 and 12 inclusive

  Create a java program

UserApp and PrettyPrintUtility multiple times (supplying different TransData test file names), the AutoTesterUtility PROGRAM will be the driver program.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd