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");

output would be:

MAKE            MODEL           PRICE

---------------- ---------------- ----------------

Toyota          Camry           18000

Toyota          Tacoma          19000

Toyota          Highlander      35000

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.:- M92021765

Have any Question?


Related Questions in Java

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

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 ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

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?

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 ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

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 ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

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 ...

  • 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