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

  Function named quadratic that receives three parameters

Write the definition of a function named quadratic that receives three double parameters a , b , c . If the value of a is 0 then the function prints the message "no solution for a=0" and returns.

  How to program print a one-year reminder list

Have the program print an error message and ignore a reminder if the corrsponding day is negative or larger than 31 (using the continue statement)

  Find out the total of balances

Display all the contents of the file in a tabular format with the first row being a header row and write to a file that is called account numbers.txt only the account numbers from the read file.

  Program to determines and print all prime numbers

Use this function in program which determines and prints all prime numbers between 2 and 10,000. How many of these numbers do you actually have to test before being sure that you have found all primes?

  What criterion is being used to determine best estimates

What we would like to do is create similar tables in an .rtf file that produces the same statistics for any numerical value against each level of a know classification/factor from any data set we wish to inspect.

  Write program which translate letter grade into number grade

Write program which translates a letter grade into number grade. Letter grades are A, B, C, D, F, possibly followed by + or -.

  Write a prolog program that finds the last item in a list

Write a Prolog program that finds the last item in a list. Include a test query.

  Program to compute perimeter and area of rectangle

Write a program that asks for length L and the width W of a rectangle, then compute perimeter and area of the rectangle.

  Write program to prompt number of rooms in house

Write down the program which prompts for number of rooms in house. Use input, n, to declare array of rectangles dynamically. In loop, input dimensions for n rooms.

  Design a math sorting game

Using Visual Studio 2010, design a math sorting game. A random number between 1 and 99 will be generated and displayed to the user. User will quickly have to divide that number by 3, and come up with remainder.

  Op-codes-add microcode to overlapping address ranges

Bmov a,b,n. This Block Move instruction moves n bytes of data from location a in memory to location b. Deal correctly with case of overlapping address ranges.

  Write a shell script to read from the keyboard

Write a shell script called poject. 21 to read from the keyboard and display on the monitor first name, last name and age if the age is less than 50. If the age is greater than 50, it will display your are over 5 instead of the age.

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