Wednesday, August 26, 2009

Description:-
Make easy and different approach in identifying tiles. Excellent for, the tiles to be selected for particular area. Can use different types of tiles, of different square feet’s. Recommended, tiles are of three types.

1) Useful, for identifying tile for suitable area.
2) Suitable for business considering rule (time factor) and economy.
3) Recommended, area to be non-zero.
4) Recommended, tiles contain an area other than zero.
5) Tiles can be used for both indoors and outdoors.
6) Wastage, for the area is considered.




Inputs and outputs:-
The inputs are
a) Area of the required room
b) Area of tiles of 3 types.
1) type1
2) type2
3) type3.

The outputs to be calculated
a) Number of tiles used.
b) Wastage of each tile.



Algorithm:-
1. Among the tiles of each type, identify the type of tile which is bigger.
2. Then by using the formulae, calculate the number of tiles used.
3. Find out the area occupied by the each tile.
4. By using the area of each tile and total area, calculate the left over area.
5. Among the tiles, identify the tile which will be suitable, to fill the left over area.
6. Calculate the wastage of each tile.





Business rules:-

1) Always the use the bigger tile to start.
2) Economical tile should always be selected among the tiles.


1. FLOW CHART FOR IDENTIFYING THE BIGGER TILE



























2. FLOW CHART FOR CALCULATING NUMBER OF TILES


3. FLOW CHART FOR CALCULATING AREA OCCUPIED THE TILE.






4. CALCULATE THE LEFT OVER AREA.





































5. TO IDENTIFY THE SUITABLE TILE FOR THE LEFT OVER AREA BY CAL. THE WASTAGE.












TOTAL FLOW CHART:-



Program:-

#include
#include
void main()
{
float a,t[10],b,m,atile,lf,u[10],p,w,y[10];
int i,tile,j,q,s=2;
printf("enter the area of room");
fflush(stdout);
scanf("%f",&a);
printf("enter the tiles");
fflush(stdout);

/****************************************************
function name: negative
parameters : i,b
description : tiles are made non-negative in this.

****************************************************/
int negative( int b)
{
int t[100],i;
for(i=0;i<=2;i++)
{
scanf("%f",&b);
if(b<0) /* tiles are made non-negative in this*/
{
b=-b;
}
t[i]=(b); /* for the loop, tiles are passed to an array*/

}
}




/*************************************************
function name: big
paramaeters : m,i.
description : the bigger tile of all is calculated.

*************************************************/
float big(int t[i])
{
int m,i;
m=t[0];
for(i=1;i<=2;i++)
{
if( mm=t[i];
} /* the bigger tile is calculated */
}
printf(" big is...%f \n",m);
tile=(int) (a/m); /* number of tiles calculated*/
printf(" no. of tiles is..%d \n",tile);
atile=(tile*m); /* area occupied by big tile*/
printf(" area of tile is..%f \n",atile);
lf=(a-atile); /* left over area is calculated */
printf("left over is..%f \n",lf);

if(lf!=0)
{
for(j=0;j<=2;j++)
{
if(t[j]==0) /* if tile area is zero loop continues */
{
continue;
}


if(t[j]{
y[j]=t[j]; /* tiles lesser than leftoverarea are stored*/
while(t[j]{
t[j]=y[j]*s;
s++;
}
}
u[j]=t[j]-lf;
}

/*****************************************************
function name : suitable
parameters : p,q.
Description : suitable tile for the left over area is calculated.

*****************************************************/
int suitable(int u[j])
{
int p,q;
p=u[0];
for(q=1;q<=2;q++)
{
if(p>u[q])
p=u[q];
} /* suitable tile is calculated and stored */
}
}
p=p+lf;
printf("%f\n",p);
w=p-lf; /* wastage is calculated */
printf(" wastage is..%f",w);
}






test cases:-

1)
area=100 tile1=3.5,tile2=2.5,tile3=1.5
enter the area of room 100
enter the tiles3.5
2.5
1.5
big is...3.5
no. of tiles is..28
area of tile is..98
left over is..2.
2.5
suitable tile is 2.5
wastage is..0.5

2)
area=1000 tile1=5,tile2=2,tile3=1
enter the area of room1000
enter the tiles5
2
1
big is...5
no. of tiles is..200
area of tile is..1000
left over is..0

wastage is..0







3)
area=100 tile1=0,tile2=0.5,tile3=0.7
enter the area of room100
enter the tiles0
0.5
0.7
big is...0.7
no. of tiles is..142
area of tile is..99.400002
left over is..0.599998
suitable tile is 0.7
wastage is..0.100002

4)
area=999.9 tile1=2.15 tile2=3.09 tile3=11.7
enter the area of room999.9
enter the tiles2.15
3.09
11.7
big is...11.7
no. of tiles is..85
area of tile is..994.5
left over is..5.400024
6.18
suitable tile is 3.09
wastage is..1.049976






5)
area=55000 tile1=36.2, tile2=59.6, tile3=42.3
enter the area of room55000
enter the tiles36.2
59.6
42.3
big is...59.599998
no. of tiles is..922
area of tile is..54951.199219
left over is..48.800781
59.599998
suitable tile is 59.599998
wastage is..10.799217

6) area=50 tile1=12.3 tile2=23.5,tile3=1.3
enter the area of room50
enter the tiles12.3
23.5
1.3
big is...23.5
no. of tiles is..2
area of tile is..47.
left over is..3.
3.9
suitable tile is 1.3
wastage is..0.9







7)
area=100000 tile1=5550.5, tile2=6650.6, tile3=9000.7
enter the area of room100000
enter the tiles5550.5
6650.6
9000.7
big is...9000.700195
no. of tiles is..11
area of tile is..99007.703125
left over is..992.296875
5550.5
suitable tile is 5550.5
wastage is..4558.203125

8)
area=10 tile1=23.5 tile2=1.3 tile3=0.5
enter the area of room10
enter the tiles23.5
1.3
0.5
big is...23.5
no. of tiles is..0
area of tile is..0
left over is..10
10.
suitable tile is 0.5
wastage is..0.







9)
Area=19636363,tile1=1.5,tile2=0.5,tile3=100000.55
enter the area of room19636363
enter the tiles1.5
0.5
100000.55
big is...100000.546875
no. of tiles is..196
area of tile is..19600108
left over is..36254.
36254.
suitable tile is 0.5
wastage is..0.

10)
Area=10,tile1=-1.5,tile2=-0.5,tile3=-0.05
enter the area of room10
enter the tiles-1.5
-0.5
-0.05
big is...1.5
no. of tiles is..6
area of tile is..9.
left over is..1
1.000000
suitable tile is -0.5
wastage is..0




pass cases:-

Area Tile1 Tile2 Tile3 No.of tiles Wastage


55000 36.2 59.6 42.3 28 0.5


1000 5 2 1 200 0


100 0 0.5 0.7 142 0.10002


999.9 2.15 3.09 11.7 85 1.049976


55000 36.2 59.6 42. 922 10.799217


50 12.3 23.5 1.3 2 0.9


100000 5550.5 6650.6 9000.7 11 4558.20312

10 23.5 1.3 0.5 0 0


19636363 1.5 0.5 100000.55 196 0

69.3 -9.3 2.3 6.3 11 0











Failure cases

Number Area Tile1 Tile2 Tile3

1 50 1.5 2.7 2.9

2 -100 3.5 3.6 1.5

3 100 0 0 0.0



case:- If the area of tile is smaller than left over area.




No comments:

Post a Comment