Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The purpose of Homework 1 is brushing up C++ skills and warming up for future programming assignments. Vectors are not allowed. Linkedlist in C++ library

The purpose of Homework 1 is brushing up C++ skills and warming up for future programming assignments. Vectors are not allowed. Linkedlist in C++ library should not be used. The program has the following functionality: 1. Once it starts, it asks the user to type the input file name (a txt file). The print out information must be: Please input the filename: 2. The program uses the file name to open the file. The file has a number of lines. Each line has two numbers separated by a comma. Therefore, there are actually two columns of numbers. For example: 312312, 56877 2267, 3698 3, 3478 87907, 768 3. The program processes the input data to calculate the average value of all valid numbers in the first column and the largest value of all valid numbers in the second column. The print out should be The average value of all numbers in the first column: XXX.XXXX The largest value of all numbers in the second column: XXXXX The total number of rows in the file is: XXXX The invalid numbers are: XXX, XXX, XXX, ... Requirements: 1. [will be 0 if it does not compile or crash when it starts] The homework must be done in C++ and compatible to C++11. A brief readme.txt file about how to compile using g++ in command line should be provided. Your submission must be in a .zip or .tar.gz file. 2. [5%] The Following identification information must be included at the beginning of your cpp file. //Name: XXXXXXX //NetID: ab1234 //Email: XXXX@csueastbay.edu 3. [5%] The output average value should retain 4 decimal digits. 4. [10%] The program must use cin and cout to deal with command line input and output. 5. [10%] The program must ask user to input again without crashing file name is invalid. 6. [10%] You can only use array (no vectors, no linked list, actually you also can do it without array...) to solve this. 7. [30%] Students must implement loops by themselves to calculate the average and to find the largest value, invalid numbers, and number of rows.

8. [30%] There are invalid numbers (like 1P24...) in the input data file, make sure those numbers will be recognized and abandoned automatically by your program without crashing.

the read file is

312312,56877 2267,3698 3,3478 87907,768A 3102,21075 2356,16293 5372,43T66 4004,89315 9966,17083 6208,52580 4575,22716 9880,89827 8114,38759 1116,85613 6684,5135 4639,68432 6306,42074 4657,68000

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 And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

1. Let a, b R, a Answered: 1 week ago

Answered: 1 week ago