Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program that does the following jobs. Step1. Creates a Car table with car manufacturers, models, fuel efficiency (MPG), and price. Step2. Reads

Write a Java program that does the following jobs.

Step1. Creates a Car table with car manufacturers, models, fuel efficiency (MPG), and price.

Step2. Reads data from a text file and insert the cars to the table created in Step 1.

Step3. Interact with the user, where the user can select one of the following actions.

- (Q) Quit: quit the program

- (A) Add a car: insert a car to the table

- (C) Calculate avg: calculate the average MPG

- (W) Write the entire table to a text file

- (P) Print the entire table

- (M) Print a subset of the cars based on the price (ex. Print cars with price <= 25000)

The user can choose one of these actions with typing Q,A,C, W, P, or M in the console. When adding a car, the user must provide manufacturer, model, mpg, and price through the console. When writing the table to a text file, the user must provide output text file name. When selecting a subset of the cars based on price, an upper bound price value must be provided.

Four files are provided with the assignment:

1. CarDB.java: the main class of this assignment. -- https://ufile.io/mqt3h

2. Database.properties: file for Apache Derby -- https://ufile.io/r12y8

3. SimpleDataSource.java: file for Apache Derby -- https://ufile.io/qk7wi

4. Carmpg.txt: sample text file for Step 2. -- https://ufile.io/4iauf

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions