The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 3 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Write a public class called Find2Max with a method called run with
the following header:
public void run()
The method run whould solve the following problem:
1. prompt the user to enter the number of students and
2. for each student prompt the user to enter the name and score
3. when done reading data for all students, display the two students
with the highests scores.
(notice that if the number of students is less than 2, the program
still reads two students)
Examples:
% java Find2Max
Enter the number of at least 2 students: 1
Enter a student name: Jon
Enter a student score: 100
Enter a student name: Ana
Enter a student score: 90
Top two students:
Jon's score is 100.0
Ana's score is 90.0
% java Find2Max
Enter the number of at least 2 students: 5
Enter a student name: Arnold
Enter a student score: 88.4
Enter a student name: Kirk
Enter a student score: 87.3
Enter a student name: Holland
Enter a student score: 79.6
Enter a student name: Prince
Enter a student score: 74.8
Enter a student name: Battle
Enter a student score: 50.1
Top two students:
Arnold's score is 88.4
Kirk's score is 87.3
% java Find2Max
Enter the number of at least 2 students: 0
Enter a student name: foo
Enter a student score: 12
Enter a student name: baz
Enter a student score: 23
Top two students:
baz's score is 23.0
foo's score is 12.0
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly