Nbspwrite a program that asks the user for a file name


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.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Nbspwrite a program that asks the user for a file name
Reference No:- TGS01177067

Expected delivery within 24 Hours