-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquest.txt
105 lines (82 loc) · 1.53 KB
/
quest.txt
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
create c class Car having
carId -int
brand -string
testConducted -int
testPassed -int
environment -String
create constructors gettes and setters for each of these private variables
->
read the input in main method using Scanner class (4 cars)
#create a static method findByPassedEnv that accept a list of cars and a string (environment) as input
it should return an integer which is the number of test passes for the given input env that
matches the array of cars objects . if no env matches it should print "no matching env"
#create a static method findGrade that accept a list of cars and a string(brand)
it should return a string(grade) on the basis rating by following formula only if that matches the given brand
rating =(testPassed *100) /testConducted
grade= "A1" if rating >80
grade= "B2" if rating <80;
if no brand matches , print "no matching brand"
input1
---------
100
Tesla
1000
500
Hills
200
Ford
2000
1500
Desert
300
Royce
3000
1700
Hills
400
Mercedez
1000
400
Desert
Desert1
Mercedez1
output1
---------
no matching envs
no matching brand
explanation there is no input matching Desert1 as environment
also no matching environment called Mercedez1
input2
-----------
100
Tesla
1000
500
Hills
200
Ford
2000
1500
Desert
300
Royce
3000
1700
Hills
400
Mercedez
1000
400
Desert
Desert
Mercedez
ouput2
--------
1900
B2
explanation
1900 is the sum of testPassed by the car that having environment as desert (1500+400)
B2 =given brand -Mercedez
rating =(400*100)/1000
rating =40
rating<80 therfore grade ="B2"