Q1_20251126125805.webp
N

Q1_20251126125805.webp

Zoom
if (max2Integer.MAX_VALUE) {
throw new RuntimeException("No second largest element exists (all elements are equal).");
26.
27.
28.
}
29.
30.
31.
32. }
}
return max2;
Question 2 (3 points): Assuming you are assigned to conduct the component test for the method
below, please design and create the minimum component test cases (Unit Test case) needed to
achieve 100% statement covergage and 100% decision coverage. (Use question 2 template)
Note: Assume all parameters are provided and have the correct data types.
int calculateTicketPrice(int age, char seatType, char customerType) {
int basePrice;
1.
2.
3.
int extraFee;
4.
5.
6.
7.
8.
9.
10.
11.
if (age<6) {
basePrice 30000;
}else if (age <= 17) {
basePrice 50000;
}else if (age <= 64) {
basePrice 70000;
} else {
12.
basePrice 40000;
13.
}
14.
15.
switch (seatType) {
16.
17.
18.
case 'T':
extraFee = 0;
// Regular seat
break;
19.
case 'V':
+ 100%
Close
Chưa có bình luận nào.

Thông tin

Category
SWT301
Thêm bởi
Ngọc Huyền
Ngày thêm
Lượt xem
5,884
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom