Write a java class named algebra

Assignment Help JAVA Programming
Reference no: EM131308263

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:    =, >, <, >=, <=, !=

Reference no: EM131308263

Questions Cloud

Explain the 4 stage model of supply chain integration : Explain the 4 stage model of supply chain integration and how it would apply to a business trying to enter a global market.
Two machines are being considered for manufacturing process : Two machines are being considered for a manufacturing process. Machine A has a first cost of $75, 200, and its salvage value at the end of six years of estimated service life is $21,000. The operating costs of this machine are estimated to be $6, 800..
Distribute product or service to consumer or customer : What is the specific product or service you chose?- What is the method used to distribute the product or service to the consumer or customer?
How much money the company needs to borrow in july : The treasurer for Chic Man Clothing must decide how much money the company needs to borrow in July. The company expects sales of $400,000 for July. The company has observed that 25% of its sales is for cash and that the remaining 75% is collected in ..
Write a java class named algebra : 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
Describe the article in detail : Locate a recent article discussing how ISIS uses the internet to further its terrorist recruiting, its propaganda, and its terrorist activities.
Old office building with an estimated remaining service life : Your firm is considering purchasing an old office building with an estimated remaining service life of 25 years. Recently, the tenants signed long-term leases with fixed rental rates for the first 5 years; thus, the current rental income of $150,000 ..
What was your rate of return on the stock : Similar to problem 11: you have $60,000 to invest. You put $30,000 in GAP stocks (beta of 1.8); $15,000 in Chesapeake Utilities (beta of .8); $15,000 in Anheuser-Busch (beta of .6). What is you portfolio beta? You own 1 share of Martha Stewart Omnime..
What is the beta of your stock portfolio : ou expect to receive a $1.00 dividend the next time your stock pays dividends. If your required rate of return (RRR) on the “dog” is 20% and the growth rate is 2%, what should this stock sell for?  You have $80,000 to invest in stocks. You select 2 s..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create a virtual directory

Create a Web archive file and attach to this assignment. Do not copy (cut and paste) any example code, create your own code and use the examples as a guide.

  Write a java program that inserts 25 random integers

Write a Java program that inserts 25 random integers ranging from 0 to 100 into an ArrayList in ascending order. The program should then output the numbers and display the sum and average of the numbers.

  Important components of a script

Bash scripting can be a very useful tool to manage Linux servers and workstations. The important components of a script include variables, keyboard input, terminal output, decision making, and loops. Give some simple examples of bash script that i..

  Prints all real solutions to the quadratic equation

Write a Java program that prints all real solutions to the quadratic equation ax^2 + bx + c = 0. Read in a, b, c and use the quadratic formula

  The code must take into account

The code must take into account leap year and adding or subtracting between years. Write two additional methods that you come with on your own as well.

  Java application that calculates the body mass index

Write a Java application that calculates and displays the body mass index (BMI) for N people

  Java program which, given three sides of a triangle

Produce a Java program which, given three sides of a triangle, determines whether the triangle is:

  Write a program that will prompt the user for a file name

Write a program that will prompt the user for a file name and open that file for reading. Print out all the information in the file, numbering each new line of text.

  Write a program that prompts the user to enter the mass

Write a program that prompts the user to enter the mass of a person in kilograms and outputs theequivalent weight in pounds. Output both the mass and the weight rounded to two decimalplaces. (Note that for standard Earth gravity, 1 kilogram = 2.2 pou..

  Write a payroll applicaion in java

The program should allow the user to enter information for any number of employees in this manner.

  Write the methods used in section two of main

Write the constructor for the SortTraversableLinkedList. It should create the head and tail nodes, and set the size of the list to 0, as in a typical linked list.

  Calculates the product of the following sequence

Write a java code that calculates the product of the following sequence of numbers using for/loop and do/while/loop

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