Answer:
Answered below
Explanation:
This solution is written in Kotlin programming language.
fun average (a: Int, b: Int, c: Int, d: Int, e: Int) : Double {
#variable to hold the addition of all parameters
var sum = a + b + c + d + e
#variable to hold the average of sum
var avg = sum / 5
return avg
}
#call the function to see how it works.
# this operation is done in the fun main()
var test: Double = average ( 5, 4, 7 , 3, 9)
print (test)
Answer:
Hi, I'm going to put the code answer here and you put in the corresponding line to not copy all the code in the answer.
replace the following line or adjust to the following code
/*
* CODE HERE
while(personSelect <= 0 || personSelect > 5) {
System.out.println("Wrong number, try to input the number in range 1 to 5" );
personSelect = scan.nextInt();
}
if(personSelect == 1){
person1.setGpa(newGPA);
printInfo()
}
else if(personSelect == 2){
person2.setGpa(newGPA);
printInfo()
}
else if(personSelect == 3){
person3.setGpa(newGPA);
printInfo()
}
else if(personSelect == 4){
person4.setGpa(newGPA);
printInfo()
}
else {
person5.setGpa(newGPA);
printInfo()
}
*/
Explanation:
According to the description of code, we have to add some lines to resolve the questions.
a):
In base on the input, we have to modify the <em>attribute GPA</em> with the method <em>setGpa</em> depending on the person chosing. We call the person chosen before and also call the method setGpa( ) and pass as <em>parameter</em> the GPA value obtained in tha last input
b)
In this case we have to <em>create a loop</em> for iterate the times that is necesary to get a value of person that is permit in <em>range 1 to 5</em>, and hence that we create and individual if condition to assign the GPA to the person chosen.
I hope it's help you.
Explanation:
All five things i can come up with her
1. Doors (we either open or close them)
2. Tap (we either open or close the valve)
3. Electric stove/cooker
4. The lid of containers
5. Shoes/ foot wears(we put them ON or OFF)