-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathComments.java
More file actions
56 lines (49 loc) · 1.32 KB
/
Comments.java
File metadata and controls
56 lines (49 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.upGrad;
public class Comments {
/*public static int areaCost(int l, int b){
int area = l * b;
int rate = areaRate(l,b);
return area*rate;
}
public static int areaRate(int l, int b){
if(l*b %2 ==0)
return 10;
else
return 11;
}
*/
/**
*
* @param l - length of room
* @param b - breadth of room
* @return - final cost of carpeting the room
*
* We calculate the total area, find the factor based on the area size
* then calculate the final cost of carpeting the room.
* This cost doest not include taxes.
*/
public static int areaCost(int l, int b){
//calculating area using length and breadth -- single line comment
int area = l * b;
int rate = areaRate(l,b);
return area*rate;
}
/**
*
* @param l
* @param b
* @return areaRate factor based on the dimension of the room
*
* We are taking a rate of all rooms at 10 rate factor but
* 11 for rooms with odd area dimension.
*/
/* We can use multi line comment to comment code,
or add necessary details , in more than one line
*/
public static int areaRate(int l, int b){
if(l*b %2 ==0)
return 10;
else
return 11;
}
}