The results from the mayor's race have been reported by each precinct as follows: P A B C D 1 192 48 206 37 2 147 90 312 21 3 186 12 121 38 Write a program to do the following: i. Display the table with appropriate headings for the rows and columns. ii. Compute and display the total number of votes received by each candidate and the percent of the total votes cast.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

1. The results from the mayor's race have been reported by each precinct as follows:

P A    B   C    D
1 192 48 206 37
2 147 90 312 21
3 186 12 121 38
Write a program to do the following:

i. Display the table with appropriate headings for the rows and columns.
ii. Compute and display the total number of votes received by each candidate and
the percent of the total votes cast.

2. Write a program in C++ to display the sum of the series [ 9 + 99 + 999 + 9999 ...].
Test Data :
Input the number or terms:5
Expected Output :
9 99 999 9999 99999
The sum of the series = 111105

3. Write a program in C++ to find the sum of the series 1 +11 + 111 + 1111 + .. n terms.
Test Data :
Input the number of terms : 5
Expected Output :
1 + 11 + 111 + 1111 + 11111
The Sum is : 12345

4. Write a C program to create a new array after replacing all the values 5 with 0 shifting all
zeros to right direction.
Expected Output:
Elements in original array are: 1, 2, 0, 3, 5, 7, 0, 9, 11, 5
Elements in new array are: 1, 2, 0, 3, 7, 0, 9, 11, 0,

Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Binary numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education