subject

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);
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:40
Reading characters and strings from the keyboard: consider the following c++ program 1. #include 2. #include 3. using namespace std; 4. mystring1 5. 6. int main() 7. { 8. 9. string mystring1, mystring2; mychar1 10. 11. 12. char mychar1, mychar2; 13. 14. cout< < "enter a string: "; mychar2 15. 16. cin> > mystring1; // 17. cin.get(mychar1); 18. cin> > mychar2; 19. getline(cin,mystring2); mystring2 20. 21. 22. cout<
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
The average cost of one year at a private college in 2012-2013 is $43,289. the average grant aid received by a student at a private college in 2012-2013 is $15,680.   what is the average student contribution for one year at a private college in 2012-2013?
Answers: 3
question
Computers and Technology, 23.06.2019 03:00
State 7 common key's for every keyboard
Answers: 1
question
Computers and Technology, 23.06.2019 19:00
Now you’re on your own. include a short summary of this section with plots in your lab report. write a matlab script file to do steps (a) through (d) below. include a listing of the script file with your report. 1 the soundsc(xx,fs) function requires two arguments: the first one (xx) contains the vector of data to be played, the second argument (fs) is the sampling rate for playing the samples. in addition, soundsc(xx,fs) does automatic scaling and then calls sound(xx,fs) to actually play the signal. mcclellan, schafer, and yoder, dsp first, 2e, isbn 0-13-065562-7. prentice hall, upper saddle river, nj 07458. c 2015 pearson education, inc. 4 mcclellan, schafer and yoder, signal processing first. prentice hall, upper saddle river, new jersey, 2003. c 2003 prentice hall. (a) generate a time vector (tt) to cover a range of t that will exhibit approximately two cycles of the 4000 hz sinusoids defined in the next part, part (b). use a definition for tt similar to part 2.2(d). if we use t to denote the period of the sinusoids, define the starting time of the vector tt to be equal to t , and the ending time as ct . then the two cycles will include t d 0. finally, make sure that you have at least 25 samples per period of the sinusoidal wave. in other words, when you use the colon operator to define the time vector, make the increment small enough to generate 25 samples per period. (b) generate two 4000 hz sinusoids with arbitrary amplitude and time-shift. x1.t / d a1 cos.2
Answers: 1
You know the right answer?
Create a HighestGrade application that prompts the user for five grades between 0 and 100 points and...
Questions
question
Mathematics, 12.07.2019 07:00
question
Mathematics, 12.07.2019 07:00
question
Mathematics, 12.07.2019 07:00
Questions on the website: 13722361