Exam requirement
a-Full source code with comment
b-Explanation of the program-in MS word
c-Screenshot of the running program.
C How to Program Book (Paul Deitel, Harvey Deitel)
Questions
7.32: (Polling) The Internet and the web are enabling more people to network, join a cause, voice
opinions, and so on. The U.S. presidential candidates in 2008 used the Internet intensively to get out
their messages and raise money for their campaigns. In this exercise, you’ll write a simple polling
program that allows users to rate five social-consciousness issues from 1 (least important) to 10
(most important). Pick five causes that are important to you (e.g., political issues, global
environmental issues). Use a one-dimensional array topic (of type char *) to store the five causes. To
summarize the survey responses, use a 5-row, 10-column two-dimensional array responses (of type
int), each row corresponding to an element in the topics array. When the program runs, it should ask
the user to rate each issue. Have your friends and family respond to the survey. Then have the
program display a summary of the results, including:
a) A tabular report with the five topics down the left side and the 10 ratings across the top, listing in
each column the number of ratings received for each topic.
b) To the right of each row, show the average of the ratings for that issue.
c) Which issue received the highest point total? Display both the issue and the point total.
d) Which issue received the lowest point total? Display both the issue and the point total.
Exam requirement
a-Full source code with comment
b-Explanation of the program-in ms word
c-Screenshot of the running program.
C How to Program Book (Paul Deitel, Harvey Deitel)
Questions
7.33 (Carbon Footprint Calculator: Arrays of Function Pointers) Using arrays of function pointers, as
you learned in this chapter, you can specify a set of functions that are called with the same types of
arguments and return the same type of data. Governments and companies worldwide are becoming
increasingly concerned with carbon footprints (annual releases of carbon dioxide into the
atmosphere) from buildings burning various types of fuels for heat, vehicles burning fuels for power,
and the like. Many scientists blame these greenhouse gases for the phenomenon called global
warming. Create three functions that help calculate the carbon footprint of a building, a car and a
bicycle, respectively. Each function should input appropriate data from the user then calculate and
display the carbon footprint. (Check out a few websites that explain how to calculate carbon
footprints.) Each function should receive no parameters and return void. Write a program that prompts the user to enter the type of carbon footprint to calculate, then calls the corresponding
function in the array of function pointers. For each type of carbon footprint, display some identifying
information and the object’s carbon footprint.