Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 1 AVGCalculator is an application that reads a student name and grades for a specific number of courses, then calculates and prints the average.

QUESTION 1
AVGCalculator is an application that reads a student name and grades for a specific number of courses, then calculates and prints the average.
To accomplish this task, use the following methods as specified:
AVGCalculator:
Ask the user to enter his/her name.
Ask the user to enter the number of courses.
Ask the user to enter the grades for each course.
Checking:
If the student name includes any digits an exception will be thrown with the following message:
" Name should not include any digits..! "
If the number of courses is less than or equal 0, an exception will be thrown with the following message:
" Number of courses should not be 0..! "
If the sum of all grades is less than or equal 0, an exception will be thrown with the following message:
" Total of grades should be greater than 0..! "
If all condition are satisfied then the method should return the average of all grades.
main method:
Call the method AVGCalculator and print the cost to the user.
Handle any exceptions that might occur in your code and print the exception message in the catch block.
image text in transcribed
QUESTION 1 . AVGCalculator is an application that reads a student name and grades for a specific number of courses, then calculates and prints the average To accomplish this task, use the following methods as specified: KGCalculator: Ask the user to enter his/her name. Ask the user to enter the number of courses. Ask the user to enter the grades for each course Checking . If the student name includes any digits an exception will be tlurown with the following message " Name should not include any digits./1 If the number of courses is less than or requal8, an exception will be thrown with the following message: "Number of courses should not be 0../" 6 If the sum of all grades is less than or equal O, an exception will be thrown with the following message: Total of grades should be greater than 0../" . If all condition are satisfied then the method should returu the average of all grades. main mothed . Call the method G Calculator and print the cost to the user Handle any exceptions that might occur in your code and print the exception message in the catch block

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Question Can life insurance be used in a Keogh (HR 10) plan?

Answered: 1 week ago