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

  Classes using set and get methods

Create a java program that contains two classes using set and get methods. I need the program to return the area and perimeter of a rectangle. I wrote a program and he returned to me saying I used the wrong constructors and didn't create a the sec..

  Calculates the cutoff frequency in a simple rc circuit

Write a simple Java application which calculates the cutoff frequency in a simple RC circuit

  Distance traveled modification

Distance Traveled Modification

  The program should ask the user to enter the student'' answer

Your program should store these correct answers in an array. (Store each question's correct answer in an element of a string array.) the program should ask the user to enter the student's answers for each of the 20 questions, which should be stored i..

  Design a boolean function named isprime,

A prime number is a number that is only evenly divisible by itself and 1. For example, the number 5 is prime because it can only be evenly divided by 1 and 5. The number 6, however, is not prime because it can be divided evenly by 1, 2, 3, and 6. Des..

  An infix to postfix method for my java program.

an infixToPostFix method for my java program. The method must work with stacks and it should take a string as parameter. The method should be able to convert to postfix mathematic expressions such as: (12 + 4) - 23(9-6)/12. Treat the parenthesis as l..

  Write a java program that declares an array alpha of 50

Write a Java program that declares an array alpha of 50 elements of type double. Initialize the array so that the first 25 elements are equal to the square of the index variable, and the last 25 elements are equal to three times the index variable. O..

  Write a program to find solution tocryparithmetic puzzle

Write a program (Crypta.java) that finds a solution to the cryparithmetic puzzle: TOO + TOO + TOO+ TOO = GOOD

  Write an application that extends jframe

Write an application that extends JFrame and that displays a phrase in every font size from 6 through 20.

  Methods

Assignment describe the basic working of methods. How to write a method in java and how to call a method.

  Write java applet for costco gas station

Write a java applet for costco gas station. The applet will first ask you whether you are a costco customer, then the grade of gas you want to use: grade 87, 89, or 91.

  Outline a test plan for a substantial real-life system

Describe how you would approach the design and testing process to ensure success and quality in the result and where are the risks? How are you going to address them?

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