Zookal
Zookal

We’d love to hear any feedback or comment from you!

© 2011-2021 Zookal Pty Ltd

View question and answer

From our collection of questions and answers
Engineering · Computer Science
Question details

Write a simple driver/client/main class with 2 methods. On java.

The main() method should:

  • Call a method called fileMax()
  • If the method generates an exception, print out the message generated by the Exception

The fileMax() method should:

  • Read in the data from a file called: numbers.txt The numbers from the file should be stored into your choice of an array or ArrayList... A sample version of this file has been provided, but the one being tested with may have between 1 and 10000 numbers.
  • If the array or ArrayList contains only 1 element (because the file only contained one element), throw an MissingDataException with the message "Exception: File doesn't have enough data!"
  • Calculate the maximum of the numbers in your array or ArrayList (must have a separate loop that goes through the array or ArrayList to find the maximum of the values in the array or ArrayList to receive full credit)
  • Print the average calculated by the code along with the EXACT correct message from below:
    • If the maximum is greater than 100, print "There is a big number in the file"
    • If the maximum is less than 100, print "The numbers in the file are small"
    • If the maximum is exactly 100, print "The maximum is exactly 100"

Grading Breakdown:

  • 10 -- Correctly and completely reading from the file and storing it into your array or ArrayList
  • 5 -- Correctly and completely using a loop to calculate the maximum of the numbers in your array or ArrayList
  • 5 -- Correctly and completely providing the required output of the program
  • 10 -- Correctly creating the Exception class
  • 10 -- Correctly generating/throwing the Exception
Answer
Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.

Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.