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.
A constructor that doesn't need to accept arguments is a default constructor.
Default constructors can either be called with no arguments or with default arguments provided for <em>every</em> parameter.
int IsAbundant(int n)
{
int divisorSum = 0;
for (int i = 1; i < n; i++) {
if ((n % i) == 0) {
divisorSum += i;
}
}
return divisorSum > n;
}
int main()
{
int number = 0;
do {
printf("Enter a number (0 to quit): ");
scanf_s("%d", &number);
if (IsAbundant(number)) {
printf("%d is abundant!\n", number);
} else
{
printf("%d is not abundant.\n", number); }
} while (number > 0);
return 0;
}
Answer:
The more RAM your CPU has access to, the easier its job becomes, which enables a faster computer. If you do not have a sufficient amount of RAM than your CPU has to work much, much harder to transfer data, which severally damages the computer's performance. Random access memory also helps your system support software.
It’s accessible to everyone across the globe