Sunteți pe pagina 1din 1

CSEB134 Programming I

College of Computer Science and Information Technology

Structure
Question 1

(a) Define a structure called book with the following elements:


id of type integer
title of type string that can store a maximum of 50 characters
publisher of type string that can store a maximum of 20 characters
unit price of type float

(b) Declare a variable textbook of (type) structure book and assign the following information
into the variable from the standard input.

ID: 1234
Title: Problem Solving and Programming
Publisher: Prentice Hall
Unit price: 44.50

(c) Write appropriate program that prints back all the information entered.

Question 2

By making use of the structure defined in (a) above, write a program that reads id, title, publisher
and unit price for at least 5 books and store them into an array of structure book called
storybook.

Question 3

An instructor needs a program that reads marks for each student for a particular subject. The
marks are from three projects, two tests and one final exam, which are stored as elements of
structure student. The program then computes the project marks average, the test marks
average, and the final exam mark, and multiply them with their respective weight as shown in
Table 1 below.
Table 1
Assessment Weight
Project 1
Project 2 30%
Project 3
Test 1
20%
Test 2
Final examination 50%
Total 100%

Finally, the program should calculate the total mark for each student and determine his grade
for the subject based on the following grading scheme.

Semester average Grade


90 100 A
80 89 B
70 79 C
60 69 D
0 59 F

By HA 2013 1

S-ar putea să vă placă și