Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project 01 - Java Review and ArrayLists Due: ONE HOUR BEFORE your closed lab session Overview For this short project you will write a program

Project 01 - Java Review and ArrayLists

Due: ONE HOUR BEFORE your closed lab session

Overview

For this short project you will write a program to review the fundamentals of Java programming. This project will allow you to practice decomposing programs into methods, various programming fundamentals (loops, branching, etc.) and the use of file I/O. In addition, this project will allow you to practice using the ArrayList class.

Objectives

Practice with programming fundamentals

Review of various Java fundamentals (branching, loops, variables, methods, etc.)

Review of Java File I/O concepts

Practice with Java ArrayList concepts

Project 01 Instructions

For this short project you will write a program that delivers a simple inventory summary report. Your program will read data about various products in a store's inventory from a file into a number of ArrayLists. Your program will then display a summary report of the information from the inventory file. Note that part of this assignment is determining how you should break your code down into methods. You will not be given the methods to use but instead must determine what methods should be used for this project. DO NOT submit a monolithic solution where all of your code is in the main method. Monolithic solutions will receive at best a maximum score of 6 points, regardless of correctness of output. Before beginning to code, think carefully about how the actions being taken by this program can be broken down into subroutines rather than monolithic operations. Create a new Java Project named Project01 and a new Java class named Project01.java for this assignment.

Project 01 Description

Here is a sample transcript of the output of this program:

Enter database filename: proj1_input.txt Product Summary Report ------------------------------------------------------------ Title: The Shawshank Redemption Product Type: DVD Price: 19.95 Quantity: 100 Title: The Dark Knight Product Type: DVD Price: 19.95 Quantity: 50 Title: Casablanca Product Type: DVD Price: 9.95 Quantity: 137 Title: The Girl With The Dragon Tattoo Product Type: Book Price: 14.95 Quantity: 150 Title: Vertigo Product Type: DVD Price: 9.95 Quantity: 55 Title: A Game of Thrones Product Type: Book Price: 8.95 Quantity: 100 ----------------------------------------------------------------- Total products in database: 6 Largest quantity item: The Girl With The Dragon Tattoo (Book) Highest total dollar item: The Girl With the Dragon Tattoo ($2242.5) Smallest quantity item: The Dark Knight (DVD) Lowest total dollar item: Vertigo ($547.25) ----------------------------------------------------------------- 

The program should perform the following actions:

Ask the user to enter the name of a file that contains the inventory database (see below for the format of this file).

Input the inventory information and store it in ArrayLists (hint: Use 4 ArrayLists, one for Title, one for Type, one for Price, one for Quantity)

Find the:

Item with the largest quantity in stock

Item with the largest total dollar amount in inventory (quantity * price)

Item with the smallest quantity in stock

Item with the smallest total dollar amount in inventory (quantity * price)

Output a well-formatted report as decribed above. Note that when the items with the largest/smallest quanity are displayed, their type should be shown in parentheses next to the title, and when the items with the highest/lowest total dollar amount are displayed, their dollar amounts should be shown in parentheses next to the title. In the case where there is a "tie" between items for any of these rankings, any selection is a valid one.

Input File Format

The input file for this assignment uses the following format:

[product 1 name] [product 1 quantity] [product 1 price] [product 1 type] ... [product n name] [product n quantity] [product n price] [product n type] 

Quantity will always be an integer value, price will always be a double value. Name and type will always be a String. A sample text file for the above transcript might look like this:

The Shawshank Redemption 100 19.95 DVD The Dark Knight 50 19.95 DVD Casablanca 137 9.95 DVD The Girl With The Dragon Tattoo 150 14.95 Book Vertigo 55 9.95 DVD A Game of Thrones 100 8.95 Book 

Note that you may assume that the fill will be correctly formatted, however your code must work properly whether there is a blank line at the end of the input file or if the input file ends with the last element. Create a few test files to verify that your code works properly for different inputs. Note also that we are not giving you the number of elements that will be in the file, so you should not use arrays to solve this problem - make sure your code uses ArrayLists to store and manipulate the data.

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 Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions