Rédigé par des étudiants ayant réussi Disponible immédiatement après paiement Lire en ligne ou en PDF Mauvais document ? Échangez-le gratuitement 4,6 TrustPilot
logo-home
Examen

CS103 – Computer Programming

Note
-
Vendu
-
Pages
5
Grade
A
Publié le
06-03-2021
Écrit en
2020/2021

Computer programming assignment with Questions and answers.

Établissement
Cours

Aperçu du contenu

Assignment # 2 (Pointers & DMA)


Assignment # 2 (Pointers & DMA)
CS103 – Computer Programming (A&C)
Deadline: February 16, 2014
Find it on SLATE (http://slate.nu.edu.pk/) in

Computer Programming CS 2014-01 FSD → Assignments → Computer Programming Assignment # 2

Assignment: Problems given in assignment section should be submitted only.

Problem – 1 (Students Grade)
Write a program to calculate students’ average test scores and their grades. You may assume the following
input data:

Johnson 85 83 77 91 76
Aniston 80 90 95 93 48
Cooper 78 81 11 90 73
Gupta 92 83 30 69 87
Blair 23 45 96 38 59
Clark 60 85 45 39 67
Kennedy 77 31 52 74 83
Bronson 93 94 89 77 97
Sunny 79 85 28 93 82
Smith 85 72 49 75 63



All arrays must be created dynamically. Mentioned above file may contain any number of records.

Use three arrays: a one-dimensional array to store the students’ names, a (parallel) two-dimensional array
to store the test scores, and a parallel one-dimensional array to store grades. Your program must contain
at least the following functions: a function to read and store data into two arrays, a function to calculate
the average test score and grade, and a function to output the results. Have your program also output the
class average.

Problem – 2 (Library Summary)
Create a library fine summary program. You will read a file of library patron data containing a library
patron number, an item (book, movie, music) number, and a fine amount. At most, there will be five
library patrons in the file. You will produce a summary report that lists the total fines for all of the patrons
in the input file.

Input File
BK 502 10
MC 102 5
MV 189 7
NS 208 2


CS103 – Computer Programming (A&C) Deadline: February 16, 2014

, Assignment # 2 (Pointers & DMA)

AR 189 51
MC 122 5
NS 218 32
MC 502 23
MV 189 20
MC 102 5
BK 248 10
MC 162 80
… … …
… … …
… … …
… … …
… … …

Output file:

BK <Fine Sub Total of all BK Patrons>
MC <Fine Sub Total of all MC Patrons>
MV <Fine Sub Total of all MV Patrons>
AR <Fine Sub Total of all AR Patrons>
NS <Fine Sub Total of all NS Patrons>
--------------------------------------------
Total <Total of All patrons>


Problem – 3 (Local Elections)
Write a program that reads the names of candidates in a local election and the number of votes received
by each candidate from a file. The program should then output each candidate’s name, the number of
votes received, and the percentage of the total votes received by the candidate.

[Hint: Use Dynamic Array only. Create one array to store names, a 2D array to store votes and calculated
percentage. All functions with pointer/pointer arrays]

Your program should also output the winner of the election. A sample output is:

Candidate Votes Received % of Total Votes
Waleed Azhar 5000 25.91
Tamur Fazal 4000 20.73
Hamza Abbas 6000 31.09
Tayyab Rehman 2500 12.95
Waqas Ahmed 1800 9.33
---------------------------------------------------------
Total 19300
---------------------------------------------------------
The Winner of the Election is Hamza Abbas.




CS103 – Computer Programming (A&C) Deadline: February 16, 2014

École, étude et sujet

Établissement
Cours
Cours

Infos sur le Document

Publié le
6 mars 2021
Nombre de pages
5
Écrit en
2020/2021
Type
Examen
Contient
Questions et réponses

Sujets

$7.99
Accéder à l'intégralité du document:

Mauvais document ? Échangez-le gratuitement Dans les 14 jours suivant votre achat et avant le téléchargement, vous pouvez choisir un autre document. Vous pouvez simplement dépenser le montant à nouveau.
Rédigé par des étudiants ayant réussi
Disponible immédiatement après paiement
Lire en ligne ou en PDF

Faites connaissance avec le vendeur
Seller avatar
eston

Faites connaissance avec le vendeur

Seller avatar
eston Oxford University
S'abonner Vous devez être connecté afin de suivre les étudiants ou les cours
Vendu
-
Membre depuis
5 année
Nombre de followers
0
Documents
3
Dernière vente
-

0.0

0 revues

5
0
4
0
3
0
2
0
1
0

Pourquoi les étudiants choisissent Stuvia

Créé par d'autres étudiants, vérifié par les avis

Une qualité sur laquelle compter : rédigé par des étudiants qui ont réussi et évalué par d'autres qui ont utilisé ce document.

Le document ne convient pas ? Choisis un autre document

Aucun souci ! Tu peux sélectionner directement un autre document qui correspond mieux à ce que tu cherches.

Paye comme tu veux, apprends aussitôt

Aucun abonnement, aucun engagement. Paye selon tes habitudes par carte de crédit et télécharge ton document PDF instantanément.

Student with book image

“Acheté, téléchargé et réussi. C'est aussi simple que ça.”

Alisha Student

Vous travaillez sur vos références ?

Créez des citations précises en APA, MLA et Harvard avec notre générateur de sources gratuit.

Vous travaillez sur vos références ?

Foire aux questions