Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 5 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 27 Aug 2017 My Price 15.00

IllegalArgumentException

Question 1.
Write a class named TestScores. The class constructor should accept an array
of test scores as its argument . The class should have a method that returns
the average of the test scores. If any test score in the array is negative
or greater than 100, the class should throw an IllegalArgumentException.Demonstrate the class in a program (create a Driver class in the same file).
The program should ask the user to input the number of test scores to be counted,
and then each individual test score. It should then make an array of those scores,
create a TestScore object , and print the average of the scores.If an IllegalArgumentException is thrown, the main method should catch it, print "Test scores must have a value less than 100 and greater than 0."
and terminate the program .SAMPLE RUN #1: java DriverEnter·number·of·test·scores:5?
Enter·test·score·1:70?
Enter·test·score·2:65?
Enter·test·score·3:94?
Enter·test·score·4:55?
Enter·test·score·5:90?
74.8?Output
Enter·number·of·test·scores:Enter·test·score·1:Enter·test·score·2:Enter·test·score·3:Enter·test·score·4:Enter·test·score·5:74.8?

Question 2Write an exception class named InvalidTestScore. Modify the TestScores class
you wrote in Exercise 1 so that it throws an InvalidTestScore exception if
any of the test scores in the array are invalid.Test your exception in a program (in a Driver class located in the same file).
Your program should prompt the user to enter the number of test scores, and then
ask for each test score individually. Then, it should print the average of
the test scores.If the average method throws an InvalidTestScore exception, the main method should catch it and print “Invalid test score.”SAMPLE RUN #1: java Driver
Enter·number·of·test·scores:5?
Enter·test·score·1:70?
Enter·test·score·2:65?
Enter·test·score·3:94?
Enter·test·score·4:55?
Enter·test·score·5:90?
74.8?Output
Enter·number·of·test·scores:Enter·test·score·1:Enter·test·score·2:Enter·test·score·3:Enter·test·score·4:Enter·test·score·5:74.8?
Question 3
Write a recursive boolean method named isMember. The method should accept two
arguments : an int array and an int value . The method should return true
if the value is found in the array , or false if the value is not found in
the array .Demonstrate the method in a program that takes input from the user. First,
the program should prompt the user to enter the length of the array . Then,
it should prompt the user for every member of the array . Then, it should ask
the user for a number to search for in the array , and print whether the
number is a member of the array (either "true " or "false ").SAMPLE RUN #3: java MemberEnter·size·of·array:4?
Enter·number·for·array·index·0:7?
Enter·number·for·array·index·1:9?
Enter·number·for·array·index·2:10?
Enter·number·for·array·index·3:15?
Enter·number·to·search·for·in·array:10?
true?Output
Enter·size·of·array:Enter·number·for·array·index·0:Enter·number·for·array·index·1:Enter·number·for·array·index·2:Enter·number·for·array·index·3:Enter·number·to·search·for·in·array:true?
Question 4
Write a recursive method that accepts a string as its argument and prints the
string in reverse order. Demonstrate the method in a program that takes a
string as input from the user and prints out its reverse.
SAMPLE RUN #3: java StringReverseEnter·a·string·to·be·reversed:Wit·beyond·measure·is·man's·greatest·treasure.?
.erusaert·tsetaerg·s'nam·si·erusaem·dnoyeb·tiW?Output
Enter·a·string·to·be·reversed:.erusaert·tsetaerg·s'nam·si·erusaem·dnoyeb·tiW?

Answers

(5)
Status NEW Posted 27 Aug 2017 04:08 PM My Price 15.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)