Write a program containing a for loop

Assignment Help C/C++ Programming
Reference no: EM131195236

C++ PROGRAMMING ASSIGNMENT-

Fifty people (50) completed the following questionnaire:

Are u interested in        Very Much              Moderately        Not at all

Soccer?                       --------------         --------------         ----------

Rugby?                        --------------         --------------         ----------

Tennis?                        --------------        --------------         ----------

Athletics?                     --------------         --------------         ----------

Cycling?                      --------------         --------------         ----------

The information is encoded as follows: "if very much" has been marked, it is indicated by 1; if "moderately" has been marked, it is indicated by 2; if "not at all" it is indicated by 3.

Write a program containing a for loop (going from 1 to 50) where the answer (1, 2 or 3) of each respondent to each question is read in. (You will need five variables of type int for this). The program has to determine

  • The number of people who are not interested in any of the five sports
  • The number of people who are very interested in soccer, but not at all in rugby, and moderately or not at all interested in cycling
  • The number of people who are very interested in both athletics and cycling, but only moderately or not at all in tennis and display the three totals. Use one nested if statement in your program. You should do some error checking: only 1 or 2 or 3 may be read in. (use a do ...while loop, keep prompting the use to enter 1 or 2 or 3 if something else has been type in until the input is correct.)

Reference no: EM131195236

Questions Cloud

Reading of a collection of animal objects : Allow the reading of a collection of animal objects from an external file. Output on screen the content of a collection of animal objects. Use Iterator to achieve these goals.
Explain why spiritual assessment is important : Explain why spiritual assessment is important in terms of the "five Rs": Reason, Reflection, Religion, Relationships, and Restoration. In your opinion, which is the most important and why? As a health care practitioner, how would you support th..
What is the secondary peak current : Assume an input of 120 V RMS, 60 Hz to a 20:1 stepdown transformer. Also assume a load resistor of 200 Ohms. What is the primary or input peak voltage? What is the secondary peak voltage? What is the secondary peak current?
Leasing and buying to cost the same : How many kilometers must a car be driven per year for leasing and buying to cost the same? Use 10% interest and year-end cost. Leasing: $0.15 per kilometer Buying: $5000 purchase cost, 3-year life, salvage $1200, $0.04 per kilometer for gas and oil, ..
Write a program containing a for loop : SCSC011 PRACTICALS: C++ PROGRAMMING ASSIGNMENT. Write a program containing a for loop (going from 1 to 50) where the answer (1, 2 or 3) of each respondent to each question is read in. (You will need five variables of type int for this). The program..
Determine the time required to complete a filling : Truck has a compaction ratio of 1:2. Pickup time is 1.58 min per service. Truck spends 20 min at the disposal site. It takes 35 min to drive to the disposal site. Assume a density of 250 lbs/cubic yard for uncompacted refuse and 500 lbs/cubic yard..
Introductory statement of the company : Write an introductory statement of the company including but not limited to the type of the company, the location, the industry in which it competes, and the organizational vision and mission that encompasses the nature of the company.
Discuss advantages of leasing capital equipment : Discuss advantages of leasing capital equipment
Explain how the ratios are calculated : Write a 750- to 1,050-word paper in which you summarize the financial performance of the organization. Explain how the ratios are calculated and how the results impact the organization. In addition, explain how the organization is performing compa..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Question regarding the intervalsum

Write a function named intervalSum. This function must not accept arguments but it will ask the user to input two integers m and n and calculate and display the sum of all the integers from min(m, n) to max(m, n)

  Which is a key dimension of customer demand in foreign

Some global enterprises engage in joint research projects to broaden their contacts. What is another reason?

  Write a switch-case programming for calculation

How to use C++ to write a switch-case programming for calculation? Test the program for a wide range of possible inputs including division by zero and square root of negative values.

  To insert a sub-string in to a given main string

Write a C program that uses functions to perform the following operations: To insert a sub-string in to a given main string from a given position.

  Write a program that will indicate two straight lines

Write a program that will indicate whether two straight lines intersect. Each line is specified by giving two points (xi, yi) that are on the line

  Branching statements to control the flow of a program

The purpose of this exercise is to give you an opportunity to practice using cin to handle user keyboard inputs, use branching statements to control the flow of a program, and work on your C++ programming style

  Integerset class create class integerset for which each

integerset class create class integerset for which each object can hold integers in the range 0 through 100. represent

  Trends of data warehousing and data mining

1. Provide an executive overview that addresses the following: a. Explain the benefits and current trends of data warehousing and data mining. b. Provide two (2) examples of quality companies successfully using a data warehouse to support your answer..

  Repetition structure that includes a nested

Create your own While-End (or For-End) repetition structure that includes a nested if-then selection structure. You decide the theme. You should provide both the pseudocode and the flowchart of your example. Be sure to provide an overview of what ..

  Write a program that will store 10 integers into an array

Write a program that will store 10 integers into an array. Only accept integers between -100 and 100. Display those integers. You must then square those integers by CALLING A FUNCTION to square each individual integer. That function must be called, s..

  Write a preliminary version of the program

The last payment may be less than $50 if the debt is small, but do not forget the interest. If you owe $50, then your monthly payment of $50 will not pay off your debt, although it will come close. One month's interest on $50 is only 75 cents.

  Would this code sequence compile? explain.

Using pseudocode or C++, write the statements to enter an integer number, compute the number raised to power 5 and output the result

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