Continue to Site

help... on C programing

Status
Not open for further replies.

vkekk

Full Member level 3
67 seats in train

Dear all

Pls help me how to proceed the below problems in C language . if anybody tell algorithm/flowchart , its great help for me...

1. Write a program for the problem: the array of integers indicating the marks of the students is given, You have to calculate the percentile of the students according to this rule: the percentile of a student is the %of no of student having marks less than him. For e.g.: suppose
Student Marks
A 12
B 60
C 80
D 71
E 30
F 45
Percentile of C = 5/5 *100 = 100 (out of 5 students 5 are having marks less than him)
Percentile of B = 3/5*100 = 60% (out of 5, 3 have marks is less than him)
Percentile of A = 0/5*100 = 0%.

2. there are 67 seats in train . there are only 5 seats in a row and in last
row there are only 2 seats.
One person can reseve only 5 seat at a time.
If person reserving seat , the care is atken that he may get all in row. if
seats are not available in row then the arrangement is so that person group
get nearby seats.

the following class is given
public class seat
{
char name;
int seat;
boolean isSeatempty
}

1.Draw require class digram and object diagram.
2.Write function seatallot(int noofperson)
to allocate seat with seat nuber printed for the each name.

First: this is pretty simple.
1. arrange the array in ascending/descending order
2. with the position of an element u are done.

Second:

Array implementation:
U can go ahead with a 14*5 array showing the availability of the seats
If a seat is available, the particular position in the array will have 1, and 0 if not.
We can set the values accordingly in the last row.

If we have to use the classes, we can have 65 objects for that class, but that sounds, ridiculous. I amn’t much sure about the implementation with less number of objects, but with structures, its straight forward.

Second q is good

Hmmm...sounds like school home work to me.

Enlightenment said:
Hmmm...sounds like school home work to me.
yeah, feel the same , these kinda questions should be given a try first before posting for help.
i dont think u need to bang your head hard on these questions.
just give it a try!!

Points: 2