Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Consider the following "tilde table" that could be represented by the file cars.txt for persistence

MAKE~MODEL~TYPE~PRICE

Toyota~Camry~Sedan~18000

Toyota~Tacoma~Truck~19000

Ford~Mustang~Sport~21000

Chevrolet~Corvette~Sport~48000

Ford~F150~Truck~25000

Toyota~Highlander~SUV~35000

Since this is just for education purposes we will allow tilde tables to have the following attributes and limitations:

-at most 12 columns

-first row represents column names

-all columns are strings (unless you want to define some types)

-column values and column names are limited to 16 characters

Write a java class named Algebra that will eventually have static methods representing the relational algebra and one additional method which displays the contents of a tilde table.  All methods except for the display method return a string indicating success or an error message and for every successful operation a new tilde table is produced on disk.  For now implement the method to show the table, the project operation, the restrict operation, and one other of your choice from this list:

JOIN (assumes natural inner join), UNION, MINUS, INTERSECT, DIVIDE

So the main body of a driver program might look like this:

//restrict the cars table to toyotas producing a table named toyotas

Algebra.Restrict("cars","MAKE='Toyota'","toyotas");

//project just three columns from the toyotas table producing a table named answer

Algebra.Project("Toyotas","Make,Model,Price","answer");

//display the contents of the answer table

Algebra.Display("answer");

Make your program generalizable. That is, it should work with any tilde table.   Since the assumption for option 1 is that tables may not fit into memory you are not allowed to load all the rows into an array or other collection.  You can of course load a list of column names or something small like that into memory.  If you can think of a way to clean up the temporary results tables that would be good. In order to limit the grammar your restriction condition can be limited to a single condition (so no ANDs and ORs) and your comparitors can be limited to these six:    =, >, <, >=, <=, !=

Java, Programming

  • Category:- Java
  • Reference No.:- M92062893

Have any Question?


Related Questions in Java

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Operating systems assignment -problem 1 sharing the bridgea

Operating Systems Assignment - Problem 1: Sharing the Bridge A new single lane bridge is constructed to connect the North Island of New Zealand to the South Island of New Zealand. Farmers from each island use the bridge ...

Assessment instructionsin this assessment you will design

Assessment Instructions In this assessment, you will design and code a simple Java application that defines a class, instantiate the class into a number of objects, and prints out the attributes of these objects in a spe ...

Assignment - method in our madnessthe emphasis for this

Assignment - "Method in our Madness" The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment. A Cityscap ...

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As