ava - Exceptions Create two user-defined exceptions. One is called FailingGradesException which messages "You have failed the course." The other one is called InvalidGradeException which messages "Grade is not valid!". In the main program, ask for an integer user input grade. If grade is greater than 100, call InvalidGradeException and if grade is below 75, call FailingGradesException. Print "You passed!" if no exceptions occur.   Inputs 1. Grade   Sample Output Enter grade: 85 You passed!

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter14: Exception Handling
Section: Chapter Questions
Problem 1TF
icon
Related questions
Question

Java - Exceptions

Create two user-defined exceptions. One is called FailingGradesException which messages "You have failed the course." The other one is called InvalidGradeException which messages "Grade is not valid!". In the main program, ask for an integer user input grade. If grade is greater than 100, call InvalidGradeException and if grade is below 75, call FailingGradesException. Print "You passed!" if no exceptions occur.

 

Inputs

1. Grade

 

Sample Output

Enter grade: 85
You passed!
2. Exceptions Practice Problem II
by CodeChum Admin
Create two user-defined exceptions. One is called
FailingGradesException which messages "You have failed
the course." The other one is called
InvalidGradeException which messages "Grade is not
valid!". In the main program, ask for an integer user input
grade. If grade is greater than 100, call
InvalidGradeException and if grade is below 75, call
FailingGradesException. Print "You passed!" if no
exceptions occur.
Inputs
1. Grade
Sample Output
Enter grade: 85
You passed!
Main.java
1
Java
Test Cases
Constraints
O Constraint 1
The code must contain FailingGradesException.
O Constraint 2
The code must contain InvalidGradeException.
Test Cases
O Test Case 1
Your Output
No Output
Expected Output
Enter grade: 85
You passed!
Show Differences &
Transcribed Image Text:2. Exceptions Practice Problem II by CodeChum Admin Create two user-defined exceptions. One is called FailingGradesException which messages "You have failed the course." The other one is called InvalidGradeException which messages "Grade is not valid!". In the main program, ask for an integer user input grade. If grade is greater than 100, call InvalidGradeException and if grade is below 75, call FailingGradesException. Print "You passed!" if no exceptions occur. Inputs 1. Grade Sample Output Enter grade: 85 You passed! Main.java 1 Java Test Cases Constraints O Constraint 1 The code must contain FailingGradesException. O Constraint 2 The code must contain InvalidGradeException. Test Cases O Test Case 1 Your Output No Output Expected Output Enter grade: 85 You passed! Show Differences &
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Exception Handling Keywords
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT