Computers and Technology, 16.12.2021 21:30 katelynzaro
Create a HighestGrade application that prompts the user for five grades between 0 and 100 points and stores
the grades in an ArrayList. HighestGrade then traverses the grades to determine the highest grade and then
displays the grade along with an appropriate message.
For HighestGrade, you need to use an ArrayList. You do not need to declare any Integer elements because you do not need to use a .get since you don’t need to find the index position of the grades. Use two loops. The first loop will ask the user to enter a grade. The second loop will determine the highest grade
import java. util. ArrayList;
public class DataArrayList {
public static void main(String[] args) {
ArrayList numbers = new ArrayList ();
Integer element, element1, element2;
int sum = 0;
numbers. add(new Integer(5));
numbers. add(new Integer(2));
/* compare values */
element1 = numbers. get(0);
element2 = numbers. get(1);
if (element1.compareTo(element2) == 0) {
System. out. println("The elements have the same value.");
} else if (element1.compareTo(element2) < 0) {
System. out. println("element1 value is less than element2.");
} else {
System. out. println("element1 value is greater than element2.");
}
/* sum values */
for (Integer num : numbers) {
element = num;
sum += element. intValue(); //use int value for sum
}
System. out. println("Sum of the elements is: " + sum);
}
}
Answers: 3
Computers and Technology, 23.06.2019 01:30
In deadlock avoidance using banker’s algorithm, what would be the consequence(s) of: (i) a process declaring its maximum need as maximum possible for each resource. in other words, if a resource a has 5 instances, then each process declares its maximum need as 5. (ii) a process declaring its minimum needs as maximum needs. for example, a process may need 2-5 instances of resource a. but it declares its maximum need as 2.
Answers: 3
Computers and Technology, 23.06.2019 23:00
How do you know if the website is secure if you make a purchase
Answers: 2
Computers and Technology, 24.06.2019 09:50
Create a string list. 2. use console.readline() to collect values of firstname, lastname, street, city, state, zip, save them to list. 3. write a simple linq statement, call method uppercasewords() to change first letter to uppercase. 4. create a foreach statment to display the information. public static string uppercasewords(string value) { char[] array = value.tochararray(); if (array.length > = 1) { if (char.islower(array[0])) { array[0] = char.toupper(array[0]); } } for (int i = 1; i < array.length; i++) { if (array[i - 1] == ' ') { if (char.islower(array[i])) { array[i] = char.toupper(array[i]); } } } return new string(array);
Answers: 3
Create a HighestGrade application that prompts the user for five grades between 0 and 100 points and...
Social Studies, 08.01.2021 05:20
Mathematics, 08.01.2021 05:20
Biology, 08.01.2021 05:20
English, 08.01.2021 05:20
Advanced Placement (AP), 08.01.2021 05:20
History, 08.01.2021 05:20
Chemistry, 08.01.2021 05:20
English, 08.01.2021 05:20
Spanish, 08.01.2021 05:20
Computers and Technology, 08.01.2021 05:20
Advanced Placement (AP), 08.01.2021 05:20
Mathematics, 08.01.2021 05:20