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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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