Write a class named testscores

Assignment Help JAVA Programming
Reference no: EM132380746

Introduction
This assignment practices Java skills on:
• how to handle and throw exceptions
• how to write an exception class

Task
Write a class named TestScores. The class constructor should accept a double array of test scores as its argument. The class should have a method called getAverage that returns the average of the test scores.

Next, write an exception class named InvalidTestScore.

Back to the class TestScores, if any test score in the array is negative or greater than 100, the class should throw an InvalidTestScore exception.

Demonstrate your TestScores and InvalidTestScore classes by using this demo program, TestScoresDemo.java (right click to save a copy of this file).

Example
Below is an example of how input and output of your program might look like:
To compile your code, use the command:
%javac InvalidTestScore.java
%javac TestScores.java
%javac TestScoresDemo.java
To execute your compiled program, use the command:
% java TestScoresDemo
Invalid score found.
Element: 3 Invalid Score: 101.0
The average of the good scores is 90.24

Submission
Submit your Java source files (TestScores.java and InvalidTestScore.java) using the submit program on Turing. We will use our TestScoresDemo.java to test your program. Ensure you compile and test your code using test values of your own creation as part of your submission script, demonstrating that your program compiles without errors and works as expected.

Verified Expert

This is a java program which demonstrate the use of exception and try-catch clause. In this program we implement a user defined exception class and use it in the program to trap the invalid scores which are either negative or > 100.

Reference no: EM132380746

Questions Cloud

Explain advantages of using an agile approach : Agile development methodologies have become very common in software development and information technology (IT) departments.
What are the benefits of measuring assets as intangibles : What are the benefits of measuring assets as intangibles in respect to a company's financial statements? how managers can benefit from recognising has?
Explain how is stressed defined : How is stressed defined? What are some effective cognitive and behavioral coping strategies? What coping strategies have you found to be helpful?
Potential advantages over behavioral leadership approaches : Analyze their potential advantages over the behavioral leadership approaches. Assess the four key behaviors of transformational leaders for inspiring employees.
Write a class named testscores : Write a class named TestScores. The class constructor should accept a double array of test scores as its argument. The class should have a method called
Review and reflect on the application of the theory : You are required to assess the current financial performance of an organisation within the context of its markets and its economic performance
What is the purpose of a system walkthrough : What is the effect on the auditor's tests of controls if the results of the walkthrough indicate that the controls have not been implemented effectively ?
Evaluate the findings in terms of its appropriateness : Evaluate the findings in terms of its applicability or appropriateness for the client in your case study. Compare and contrast the article you selected with.
Prepare journal entries to record the purchase and related : The building has an estimated life of 40 years and an estimated residual value of $5,000. Prepare journal entries to record the purchase.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd