Answered step by step
Verified Expert Solution
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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started