PDF Archive

Easily share your PDF documents with your contacts, on the Web and Social Networks.

Share a file Manage my documents Convert Recover PDF Search Help Contact



SP13 Lab 6 Quizzes.pdf


Preview of PDF document sp13-lab-6-quizzes.pdf

Page 1 2 3 4 5 6

Text preview


Ain Shams University
Faculty of Computer & Information Sciences
Structured Programming
Lab Exam
First year

Section 18

Write a program that takes an array of floating point values; and the size of the array, Then it should
shift the contents of each cell one place to the left, except for the contents of the first cell, which should
be moved into the cell with subscript (size-1) . Thus, for example, if the array looks like this
0.7 | 4.3 | 1.9 | 6.2 | 8.5
then when the array should be changed so that it looks like this
4.3 | 1.9 | 6.2 | 8.5 | 0.7
Ain Shams University
Faculty of Computer & Information Sciences
Structured Programming
Lab Exam
First year

Section 19

Write a program that reads an array from the user, then the program should reads and integer, and a
flag that represents either “left” or “right” then an integer represents a distance. The program should
locate the first integer in the array and then moves it either to the left or the right (according to the flag)
a number of steps equivalent to the distance.
Hint: moving to the right should returns to first position after the last position
Moving to the left should returns to last position after the first position
Sample execution:
Enter and array: 2,6,5,8,12,4,7,3
Enter an integer: 12
Enter direction: L
Enter distance: 3
Modified array: 2,12,5,8,6,4,7,3
Enter and array: 2,6,5,8,12,4,7,3
Enter an integer: 4
Enter direction: R
Enter distance: 3
Modified array: 4,6,5,8,12,2,7,3
Ain Shams University
Faculty of Computer & Information Sciences
Structured Programming
Lab Exam
First year

Section 20

There are set of 10 employees, each having id, name, hours worked, and overtime hours. The origin
payment for each employee is the hourly rate times the hours worked. The overtime payment for each
employee is one and half of the hourly rate times the overtime hours.
If the hourly rate for all employees is 25.5, write a program that asks the user to enter the data of those
10 employees in the main(), and then calculates for each employee his overall payment, which is the
summation of his origin payment and his overtime payment