Write a program that asks the user for a file name

Assignment Help Basic Computer Science
Reference no: EM13883760

C++

1) Number Analysis Program

Write a program that asks the user for a file name. Assume the file contains a series of numbers, each written on a separate line. The program should read the contents of the file into an array and then display the following data:

  • The lowest number in the array
  • The highest number in the array
  • The total of the numbers in the array
  • The average of the numbers in the array

2) Monkey Business
A local zoo wants to keep track of how many pounds of food each of its three monkeys eats each day during a typical week. Write a program that stores this information in a two-dimensional 3x5 array, where each row represents a different monkey and each column represents a different day of the week. The program should first have the user input the data for each monkey. Then it should create a report that includes the following information:
• Average amount of food eaten per day by the whole family of monkeys.
• The least amount of food eaten during the week by any one monkey.
• The greatest amount of food eaten during the week by any one monkey.
Input Validation: Do not accept negative numbers for pounds of food eaten.

 

3) Larger Than n
In a program, write a function that accepts three arguments: an array, the size of the array, and a number n . Assume that the array contains integers. The function should display all of the numbers in the array that are greater than the number n

 

4) Chips and Salsa
Write a program that lets a maker of chips and salsa keep track of sales for five different types of salsa: mild, medium, sweet, hot, and zesty. The program should use two parallel 5-element arrays: an array of strings that holds the five salsa names and an array of integers that holds the number of jars sold during the past month for each salsa type. The salsa names should be stored using an initialization list at the time the name array is created. The program should prompt the user to enter the number of jars sold for each type. Once this sales data has been entered, the program should produce a report that displays sales for each salsa type, total sales, and the names of the highest selling and lowest selling products.
Input Validation: Do not accept negative values for number of jars sold.

 

5) Largest/Smallest Array Values
Write a program that lets the user enter 10 values into an array. The program should then display the largest and smallest values stored in the array.

 

6)   2D Array Operations
Write a program that creates a two-dimensional array initialized with test data. Use any data type you wish. The program should have the following functions:
getTotal This function should accept a two-dimensional array as its argument and
return the total of all the values in the array.
getAverage This function should accept a two-dimensional array as its argument and return the average of all the values in the array.
getRowTotal This function should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The function should return the total of the values in the specified row.
getColumnTotal This function should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the
subscript of a column in the array. The function should return the total of the values in the specified column.
getHighestInRow This function should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the
subscript of a row in the array. The function should return the highest value in the specified row of the array.
getLowestInRow This function should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the
subscript of a row in the array. The function should return the lowest value in the specified row of the array.
Demonstrate each of the functions in this program.

Reference no: EM13883760

Questions Cloud

Discuss the paper on healthcare quality : Discuss the following in your paper:Inpatient/outpatient record documentation for diagnoses and services/ procedures. Healthcare quality
Which database model is used most frequently : Which database model is used most frequently in the modern business world? Why do you believe it is frequently used?
IRP-PPP and Speculating in Currency Derivatives : The U.S. three-month interest rate (unannualized) is 2%. The Canadian three-month interest rate (unannualized) is 3%. Assume interest rate parity exists. The expected inflation over this period is 5% in the U.S. and 3% in Canada. Determine the dollar..
Which database models are built on the inverted : Which database models are built on the inverted tree structure? What are the disadvantages of using the inverted tree structure for a database?
Write a program that asks the user for a file name : Write a program that asks the user for a file name. Assume the file contains a series of numbers, each written on a separate line. The program should read the contents of the file into an array and then display the following data:
Dollar spot exchange rate : The current Swiss franc to U.S. dollar spot exchange rate is SFr1.60/$. The expected inflation over the coming year is 2 percent in Switzerland and 5 percent in the United states. According to purchasing power parity, what is the expected value of th..
Is the interest rate parity holding : A foreign exchange arbitrageur notices that the Japanese yen to U.S. dollar spot exchange rate is ¥108/$ and the three-month forward exchange rate is ¥107.30/$. The three-month $ interest rate is 5.20 percent per Annum and the three-month ¥ interest ..
About to retire and he wants to buy an annuity : Your uncles is about to retire and he wants to buy an annuity that will provide him with $62000 of income a year for 20 Years, with the first payment coming immediately. The going rate on such annuites is 5.25%. How much would it cost him to buy the ..
Written communication is an essential tool : Written communication is an essential tool for any professional. As with any skill, writing well is the result of practice followed by feedback and the use of relevant and appropriate sources. Therefore, the quality of writing is graded as part of th..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  The university has recently leased a building in adelphi

The University has recently leased a building in Adelphi, Maryland. The building will house some offices, classrooms, library, and computer labs.

  Gcd that returns the greatest common divisor

Write method Gcd that returns the greatest common divisor of two integers. Incorporate the method into an application that reads two values from the user and displays the result

  Network administration processes evaluation

Network Administration Processes Evaluation

  Generate an array of 20 random integers from 0 to 9

generate an array of 20 random integers from 0 to 9. Search for the first occurrence, if any, of the number 7, and report its position in the array.

  Techniques in discovering requirements for a system

What are some of the techniques in discovering requirements for a system? Which ones work best? Which ones are the most economical?

  Critical infrastructure protection

Critical Infrastructure Protection According to the text, Critical Infrastructure Protection (CIP) is an important cybersecurity initiative that requires careful planning and coordination in protecting our infrastructure.

  Consider the procedure described in adaptive playout delay

Consider the procedure described in "Adaptive Playout Delay" for estimating average delay di. Let r1 - t1 be the most recent sample delay, let r2 - t2 be the next most recent sample delay.

  Create a rational number class

Create a Rational Number class. A Rational number has 2 parts, an integer numerator and an integer denominator. Add two constructors (negative denominators must be moved to the numerator), getters, setters, a print method, and an input method.

  Define business performance management

Define Business Performance Management and how DSS relates the Business Performance Management and Describe how Knowledge Management benefits organizations.

  How has configuration for connecting input-output changed

How has the configuration for connecting input/output (I/O) devices to computers on the motherboard changed since the late 1980s?

  Write a windows application that gets names

When designing the GUI, consider initially disabling the e-mail textbox and the button until all information is entered. Redisable them when the button is clicked. Note that you can also use the Tab Index property of GUI objects to set their order..

  Create method that prints a rectangle of characters console

Create a method that prints a rectangle of characters to the console. The method should use a character set that parameter to the method.

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