Write a program that asks the user for an input file name

Assignment Help Other Subject
Reference no: EM132586174

Program Assignment -

Part A - Write a program that asks the user for an input file name, reads from the file (it will contain an unknown number of floating-point numbers), and outputs:

1. the sum of all the numbers greater than or equal to zero,

2. the sum of all the numbers less than zero,

3. the sum of all the numbers, whether positive, negative or zero.

Use dynamic array.

Part B - Modify your program from project A so that it outputs:

1. the sum and average of all the numbers greater than or equal to zero,

2. the sum and average of all the numbers less than zero,

3. the sum and average of all the numbers, whether positive, negative or zero.

Bonus for using functions that involve a dynamic array parameter.

Requirements -

1. The program will loop again to ask if the user wants to process another file.

2. Use dynamic array to hold just the right number of floating-point numbers read from file.

3. Remember to comment well in your program and any functions you use.

Testing -

The program should be tested extensively to make sure it works as expected before you hand it in.

The program should accept a file like the followings:

-33.34 0 22.63 12.23 100.4 111 45.45

And outputs something like the following:

291.71 and 48.62 (setprecision to 2) are the sum and average of all the numbers greater than or equal to zero,

-33.34 and -33.34 are the sum and average of all the numbers less than zero,

258.37 and 36.91 are the sum and average of all the numbers, whether positive, negative or zero.

Please come up with more test cases.

Hints/Questions to Think Ahead - How to figure out how big of an array to allocate memory for?

Reference no: EM132586174

Questions Cloud

What is a neuron : 1. What is/are the function(s) of the nervous system?
What is the company margin of safety as a percentage : What is the company's margin of safety as a percentage of its sales?Molander Corporation is a distributor of a sun umbrella used at resort hotels.
What are four ways that jason should conduct research : What are four ways that Jason should conduct research to learn about Mexican culture and communication so that he can increase the effectiveness of his message
What signs might you observe that are indicative of abuse : Below are 5 short videos, When posting the submission, post the web site of the video and the questions. In this way, if students want to watch the video.
Write a program that asks the user for an input file name : Write a program that asks the user for an input file name, reads from the file (it will contain an unknown number of floating-point numbers), and outputs
What stressors are present in mr. wilko case : Mr. Wilko states he is a social drinker and "can stop at any time." How accurate is his self-assessment? What stressors are present in Mr. Wilko's case?
State the minimum number required : Tetracycline is a common medication used to treat bacterial infections. It prevents the aminoacyl-tRNA from binding to the ribosomal subunit
Calculate the dollar sales needed to attain a target profit : Calculate the dollar sales needed to attain a target profit of $15,000. Calculate the unit sales needed to attain a target profit of $10,000.
Cognitive thinking : While conducting daily travel card transactions how do you Demonstrate cognitive thinking for the purpose of reaching a decision, drawing sound conclusions,

Reviews

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

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