Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSCI 212-Fall 2017-Project1 Your goal for this project is to write a simple application that will read information about products, sort it using Insersion Sort

image text in transcribed
image text in transcribed
CSCI 212-Fall 2017-Project1 Your goal for this project is to write a simple application that will read information about products, sort it using Insersion Sort algorithm, and output it back to the user in the same format that it read. The provided data will be a list of products You will write two classes: Product and ProductSort Product class This class will be used to contain the following information about a single product ID (an exactly 10 digit number) Beard Name Prodact Name Price n cents, not dollars) Make sure the field names follow standard naming coeventions Do not make them public-the only way a user of this class should be able to modify or retrieve data in these fields is through getters and setters (which you have to write). Write two constructors for this class: e One that accepts four arguments and initializes all the fields from them. One that accepts no arguments and initializes all the fields to some appropriate default values (eg ID may be-1, price may e1, brand/product name "none" or similar). Aside from getters and setters, - read(Scanner in) write two additional methods to read or output product information 'This method will tead one line from the provided Scanner obec and populate the fields of the Product object appropriately. o O This method will reeurn true if the read was successfal; it will return false if the read was unsuccessful Ot's a way for the caller to tell if the read happened successfully). A reading error can happen in many ways: A line from input does not coatain exactly 4 tab-delimited tokens A token isn't formatted as expected (eg if an integer is expected, it must be a . sequence of digis) The ID itexactly 10 digit-long write(Printwriter out) This method will print the fields ofthe Product objecttothe provided PrintTiterolject. Make sure to handle the case where the ID is a number smaller than 1,000,000,000. Since as a winteger it will be shorter than 10 digies, you will need to ensure that it's padded with zeroes from the left. For example, an ID with value 12 should be printed as "0000000012 (prinef fanctionality may be uscful here). (the main method as well as a few others). This class will contain your program The flow of your program should be as follows: 1. Parse the command-line arguments (args in the main method). There may be either one or three of them. If the number of arguments is different than 1 or 3, print a message that helps the user a. The first argument should be the criteria based on which your program will later sort the / price in cents). If it isn't one of those, make sure to peint an error message and quit the understand the usage of the program and quit. input. It must be one of the four available ones (product id/brand name / product name program. b Optionally, the user may pass exactly two more arguments first one specifying the location of the input file and the second one specifying the location of the output file. CSCI 212-Fall 2017-Project1 Your goal for this project is to write a simple application that will read information about products, sort it using Insersion Sort algorithm, and output it back to the user in the same format that it read. The provided data will be a list of products You will write two classes: Product and ProductSort Product class This class will be used to contain the following information about a single product ID (an exactly 10 digit number) Beard Name Prodact Name Price n cents, not dollars) Make sure the field names follow standard naming coeventions Do not make them public-the only way a user of this class should be able to modify or retrieve data in these fields is through getters and setters (which you have to write). Write two constructors for this class: e One that accepts four arguments and initializes all the fields from them. One that accepts no arguments and initializes all the fields to some appropriate default values (eg ID may be-1, price may e1, brand/product name "none" or similar). Aside from getters and setters, - read(Scanner in) write two additional methods to read or output product information 'This method will tead one line from the provided Scanner obec and populate the fields of the Product object appropriately. o O This method will reeurn true if the read was successfal; it will return false if the read was unsuccessful Ot's a way for the caller to tell if the read happened successfully). A reading error can happen in many ways: A line from input does not coatain exactly 4 tab-delimited tokens A token isn't formatted as expected (eg if an integer is expected, it must be a . sequence of digis) The ID itexactly 10 digit-long write(Printwriter out) This method will print the fields ofthe Product objecttothe provided PrintTiterolject. Make sure to handle the case where the ID is a number smaller than 1,000,000,000. Since as a winteger it will be shorter than 10 digies, you will need to ensure that it's padded with zeroes from the left. For example, an ID with value 12 should be printed as "0000000012 (prinef fanctionality may be uscful here). (the main method as well as a few others). This class will contain your program The flow of your program should be as follows: 1. Parse the command-line arguments (args in the main method). There may be either one or three of them. If the number of arguments is different than 1 or 3, print a message that helps the user a. The first argument should be the criteria based on which your program will later sort the / price in cents). If it isn't one of those, make sure to peint an error message and quit the understand the usage of the program and quit. input. It must be one of the four available ones (product id/brand name / product name program. b Optionally, the user may pass exactly two more arguments first one specifying the location of the input file and the second one specifying the location of the output file

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

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions