Friday, August 28, 2009

CALENDER

DESCRIPTION:-
The primary practical use of a calendar is to identify days: to be informed about and/or to agree on a future event and to record an event that has happened. Days may be significant for civil, religious or social reasons. For example, a calendar provides a way to determine which days are religious or civil holidays, which days mark the beginning and end of business accounting periods, and which days have legal significance, such as the day taxes are due or a contract expires. Also a calendar may, by identifying a day, provide other useful information about the day such as its season.
Calendars are also used as part of a complete timekeeping system: date and time of day together specify a moment in time. In the modern world, written calendars are no longer an essential part of such systems, as the advent of accurate clocks has made it possible to record time independently of astronomical events.



ANALYSIS:-

1) For the year 1752, the days from 3 to 13 are neglected in month 9 and directly print days this case.
2) Divide the input year by 400, 4. If the remainder is zero then the year entered is a leap year. In this case, add a day to the month 2. If it is divided by 100 it shouldn’t be zero.
* Determines if a year is a leap year.
* Input parameters:
* Year (must be >0)
* Returns:
* 1 if the year is a leap year, 0 otherwise.
*


3) To calculate days in a month
Calculates the number of days in a month.
* Input parameters:
* Year (must be >0)
* Month (1 to 12)
* Returns:
* The number of days in the month (28 to 31)





4) Week day for a date
* Calculates the weekday for a given date.
* Input parameters:
* Year (must be >0)
* Month (1..12)
* Day (1..31)
* Returns:
* 0 for Sunday, 1 for Monday, 2 for Tuesday, etc…




5) Calculates the week number
* Input parameters:
* Year (must be >0)
* Month (1 to 12)
* Day
* Output parameters:
* Address of week number (1 to 53)
* Address of corresponding year
*




ALGORITHM:-

1. Set base week starts from Saturday i.e., for 1 January 0001
2. Check the input, if case it is 1752 treat as a special case and a 11 day correction is made in month 9.
3. Ensure that the year entered should be greater than zero.
4. Number of months in a year should be 12.
5. For the months 1, 3, 5,7,8,10,12, number of days in each month should be 31.
6. And for the months 4, 6,9,11 numbers of days in each month is to be 30.
7. And for the month 2, the days are to be 28 and if the year entered is a leap year, add a day.




FLOWCHARTS:-




1. For the setting the base value:

start


Set week January 0001
as Saturday.


stop


2) For calculating the leap year


start

year divides false stop
400 or 4 completely

true

stop


3. Number of months in a year

start


Calculate the number of months
in a year that is, to
print in according order.


stop

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.




Thursday, August 20, 2009

udaycoding

Description:-
We developed an algorithm, referring to tiles business.
By taking the business rule ( time factor ) into consideration, the algorithm had been developed. In this algorithm, for a particular area, the number of tiles and wastage of tiles are submitted for tiles of different types. Based on this, the choosing of tiles for particular area can be fairly identified.

The inputs, we taken in this algorithm are area of particular room, tiles of three types of different square feet. The intermediate outputs are, area occupied by the tiles of each type, left over area and the tile to be selected for the left over area.
The outputs will be number of tiles used for the particular room of area and wastage incurred.



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:-
౧.Among the tiles of each type, identify the type of tile which is bigger.
౨.Then by using the formulae, calculate the number of tiles used.
౩.Find out the area occupied by the each tile.
౪.By using the area of each tile and total area, calculate the left over area.
౫.Among the tiles, identify the tile which will be suitable, to fill the left over area.
౬.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.


START

T1>T2


T2>T3
STOP
STOP
STOP


T1>T31. FLOW CHART FOR IDENTIFYING THE BIGGER TILE



























2. FLOW CHART FOR CALCULATING NUMBER OF TILES
START
Cal no. of tiles=
Area/ (tile size)
STOP


3. FLOW CHART FOR CALCULATING AREA OCCUPIED THE TILE.

START
Cal the area occupied the bigger tile=
No. of tiles*(size of tile)
STOP





4. CALCULATE THE LEFT OVER AREA.



START
Cal the leftover area=
Area – (area occupied the tile)
STOP


































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




START
Choose the suitable tile, by cal. Wastage causes for each tile=
(Tile size*no. of tiles for particular area)-(left over area).
w1,w2,w3 respectively for each type.


w1>w3

w1>w2


w2>w3
STOP
STOP
STOP








TOTAL FLOW CHART:-


START
Calculate the number of tiles to be used, to fill the specific area =
Area/ (tile size).

Calculate the area occupied the tile each type, for the specific area=
No. of tiles*(size of tile)

Compute the left over area, by the formula=
Area – (area occupied the tile)


Identify the bigger tile, according to the business rule1.
Identify the suitable tile for left over area, by cal. the wastage caused by each type of tile.

Wastage of tiles of each type.
STOP
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) b="-b;" m="t[0];" i="1;i<="2;i++)" q="1;q<=2;q++)" p="u[0];" lf="(a-atile);" atile="(tile*m);" m="t[i];" j="0;j<=2;j++)">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 in sq.ft Tile1 in Tile2 in sq.ft

Tile3 in sq.ft
No. of tiles
Wastage in sq.ft
55000

36.2
59.6
42.3
28

0.5

1000

5

2

1

200

0

100

0

0.5

0.7

142

0.100002

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.203125

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



1) If the area of tile is smaller than left over area.
2)

Friday, August 14, 2009

uday



Description:-
We developed an algorithm, referring to tiles business.
By taking the business rule ( time factor ) into consideration, the algorithm had been developed. In this algorithm, for a particular area, the number of tiles and wastage of tiles are submitted for tiles of different types. Based on this, the choosing of tiles for particular area can be fairly identified.

The inputs, we taken in this algorithm are area of particular room, tiles of three types of different square feet. The intermediate outputs are, area occupied by the tiles of each type, left over area and the tile to be selected for the left over area.
The outputs will be number of tiles used for the particular room of area and wastage incurred.



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:-
Among the tiles of each type, identify the type of tile which is bigger.
Then by using the formulae, calculate the number of tiles used.
Find out the area occupied by the each tile.
By using the area of each tile and total area, calculate the left over area.
Among the tiles, identify the tile which will be suitable, to fill the left over area.
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.


START

T1>T2


T2>T3
STOP
STOP
STOP


T1>T31. FLOW CHART FOR IDENTIFYING THE BIGGER TILE



























2. FLOW CHART FOR CALCULATING NUMBER OF TILES
START
Cal no. of tiles=
Area/ (tile size)
STOP


3. FLOW CHART FOR CALCULATING AREA OCCUPIED THE TILE.

START
Cal the area occupied the bigger tile=
No. of tiles*(size of tile)
STOP





4. CALCULATE THE LEFT OVER AREA.



START
Cal the leftover area=
Area – (area occupied the tile)
STOP


































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




START
Choose the suitable tile, by cal. Wastage causes for each tile=
(Tile size*no. of tiles for particular area)-(left over area).
w1,w2,w3 respectively for each type.


w1>w3

w1>w2


w2>w3
STOP
STOP
STOP








TOTAL FLOW CHART:-


START
Calculate the number of tiles to be used, to fill the specific area =
Area/ (tile size).

Calculate the area occupied the tile each type, for the specific area=
No. of tiles*(size of tile)

Compute the left over area, by the formula=
Area – (area occupied the tile)


Identify the bigger tile, according to the business rule1.
Identify the suitable tile for left over area, by cal. the wastage caused by each type of tile.

Wastage of tiles of each type.
STOP
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);

int negative( int b)
{
int t[100],i;
for(i=0;i<=2;i++) { scanf("%f",&b); if(b<0) b="-b;" m="t[0];" i="1;i<="2;i++)" q="1;q<=2;q++)" p="u[0];" lf="(a-atile);" atile="(tile*m);" m="t[i];" j="0;j<=2;j++)">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 in sq.ft
Tile1 in sq.ft
Tile2 in sq.ft
Tile3 in sq.ft
No. of tiles
Wastage in sq.ft
55000

36.2
59.6
42.3
28

0.5

1000

5

2

1

200

0

100

0

0.5

0.7

142

0.100002

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.203125

10


23.5
1.3

0.5

0

0

19636363

1.5

0.5

100000.55

196

0










Failure cases
Number
Area
Tile2
Tile3
1
50
1.5
2.7
2.9
2
-100
3.5
3.6
1.5



1) If the area of tile is smaller than left over area.
2)