Create a console-mode executable class

Assignment Help Programming Languages
Reference no: EM13332164

Create a console-mode executable class (no GUI in this project; let's keep it simple) using the following specifications:

  • Name your executable class RockFiles
  • Prompt the user to enter the full (absolute) path and filename of the input file to read

o  Read the path/file name from the keyboard and use it for opening and processing the input file
o  The input file will contain an unknown number of rows up to a maximum of 200 that will contain both good and bad data
o  Using ONLY File class supplied methods, test for file's existence and the fact that it is a file MUST be verified PRIOR to opening the file.
-  If file does not exist OR if the user entry is not a file, exit the program immediately (do not try opening the file) and supply an appropriate message to the screen explaining that they program is terminating and why.

  • Hard-code (do not prompt for & read) the absolute path and name of the first output file.

o  Must be called validRecords.csv and placed in the root directory of the "D:" drive.
-  Use code that will allow it to be used on as many platforms as you can; don't hard code the separator (\ or /)...demonstrated in class.
o  This is where you will write your "valid" records from your array of type Rocks (the interface from the last project)...yes, you again are using polymorphism.

  • Hard-code the absolute path and name of a second output file.

o  Must be called suspense.csv and must also be placed in the root directory of the "D:" drive.
-  This file will hold ALL records with formatting issues (wrong type of data in a field), and/or the wrong number of fields necessary to instantiate ANY of the 3 classes used.
-  Hint:  If a Monument object is to be instantiated and placed into the array, how many fields should be on the input line? What about the MonumentBase class?  You are still only to use the largest constructors of each class.

  • Create an array of type Rocks FROM THE VALID INPUT LINES ONLY (based upon the above two qualifiers) in the same manner as the supplied Project 03 executable class; after you validate the line and determine it is OK, just instantiate the appropriate object and add the object to the array.

o  You must determine if a line is valid by using exception processing (when appropriate) AND field (token) counting (when appropriate) and any bad data lines are to be written to suspense.csv EXACTLY AS THEY ARE/EXIST
IN THE INPUT FILE...just write the entire input String row itself without any changes.
-  For a full description of bad data, see below
-  The input file layout that must be used follows at the end of this document

  • Write to the "bad data" (suspense.csv) file, each line written EXACTLY as it exists in the input file, when a line contains:

o  The incorrect number of fields to instantiate EITHER of the 2 object types...Monument or MonumentBase
o  OR Character or String data in a numeric field (improper format)
o  OR float ing point data in an integer field (improper format)
-  Do not worry about any other data checks; the above three are sufficient for this project to cut down on
programming time.

  • Create a second file (validRecords.csv), WRITING IT FROM YOUR Rocks array AFTER THE ARRAY HAS BEEN

CREATED IN ITS ENTIRETY (entire input file processed), which contains all valid records/lines (and ONLY valid records) from the input file.
o  This must be the LAST function of your program and written only after the Rocks Array has been satisfactorily completed; write it from a single loop that does nothing else but write the file.
o  A record is valid when it passes the aforementioned data checks.

Reference no: EM13332164

Questions Cloud

Evaluate the molalities of the aqueous solutions : Calculate the molalities of the following aqueous solutions. (a) 2.26 M sugar (C12H22O11) solution (density of solution = 1.12 g/mL) m (b) 0.93 M NaOH solution (density of solution = 1.04 g/mL) m (c) 5.64 M NaHCO3 solution (density of solution = 1..
What is the change in kinetic energy of the racquet ball : A racquet ball with mass m = 0.237 kg is moving toward the wall at v = 12 m/s and at an angle of ? = 30° with respect to the horizontal. What is the change in kinetic energy of the racquet ball
Compute the percent by mass of the solute : Calculate the percent by mass of the solute in each of the following aqueous solutions. (a) 3.57 g of NaBr in 78.2 g of solution % (b) 31.0 g of KCl in 144 g of water % (c) 2.8 g of toluene in 29 g of benzene %
Financed by common shares and debt : Halifax Inc. is considering a project that requires an initial investment of $10 million and promises to generate an annual after-tax cash flow of $1 million perpetually. This firm is only financed by common shares and debt
Create a console-mode executable class : Create a console-mode executable class (no GUI in this project; let's keep it simple) using the following specifications.
Calculate how long does the trip take : A river has a steady speed of 0.482 m/s. A student swims upstream a distance of 1.00 km and swims back to the starting point. If the student can swim at a speed of 1.24 m/s in still water, how long does the trip take
Explain moles of ethylene glycol of water : Calculate the molality of each of the following solutions. (a) 13.7 g of sucrose (C12H22O11) in 671 g of water m (b) 7.24 moles of ethylene glycol (C2H6O2) in 3808 g of water
Find the velocity of the airplane relative to the ground : The pilot of an airplane notes that the compass indicates a heading due west. The airplane's speed relative to the air is 120 km/h. Find the velocity of the airplane relative to the ground
Uses under the lockbox system : What amount of cash will be made available for other uses under the lockbox system?

Reviews

Write a Review

Programming Languages Questions & Answers

  Application to input five numbers by one-dimensional array

Use a one-dimensional array to solve the following problem: Write an application that inputs five numbers, each between 10 and 100, inclusive.

  Create program to calculate and display number of miles

Create a program to calculate and displays the number of miles per hour over the speed limit that a speeding driver was doing. The program should ask for the speed limit and the drivers speed.

  Program to read the contents of file into the array

Write down the program which asks user for a file name. Suppsoe the file contains the series of numbers, each written on separate line.

  Write script to inputs five number and finds negative number

Write down the script which inputs five number and finds out and outputs XHTML text which displays number of negative numbers input.

  Design and implement set of classes to model employees

Design and implement a set of classes to model the employees of a hospital: doctor, nurse, administrator, etc. Include methods in each class.

  Describing program using suiatble printf command

Yyou have to describe all of this to user using suiatble printf() statements.

  Matlab that will use the flipping of two-sided coins to sim

Write a program in matlab that will use the flipping of two-sided coins to simulate any event that has a probability of success(Ps) that ranges between 0 and 1. The simulation will most likely be approximate. It must be accurate to at least 0.01

  Program to divide string based on some delimiter string

StringTokenizer is a class in the java.util library that can divide a String based on some delimiter String (a delimiter is a separator). If the instruction StringTokener st = new StringTokenizer.

  Program instantiates four dates and allots invalid values

Demonstration program instantiates four Dates and purposely allots invalid values to some of arguments; class methods will correct invalid values.

  Create class for hardware store to represent invoice

Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store. An Invoice should include four pieces of information as instance variables a part number.

  Create class having property to store dollar value of order

Create the class which has the property to stores dollar value of order. Class has CalculateFinalAmount which uses this logic--If dollar value is at least $500, solution decreases dollar value by $50.

  Solve the programming problem

Solve the programming problem

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