![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 21.12.2020 19:30 Arealbot
Create a CourseException class that extends Exception and whose constructor receives a String that holds a college course’s department (for example, CIS), a course number (for example, 101), and a number of credits (for example, 3).
Create a Course class with the same fields and whose constructor requires values for each field. Upon construction, throw a CourseException if the department does not consist of three letters, if the course number does not consist of three digits between 100 and 499 inclusive, or if the credits are less than 0.5 or more than 6.
Write an application that establishes an array of at least six Course objects with valid and invalid values. Display an appropriate message when a Course object is created successfully and when one is not.
These must be in three different "files" as well as being written in java
Here is the code so far:
//Course. Java//
public class Course {
String department;
int courseNumber;
double credits;
final int DEPT_LENGTH = 3;
final int LOW_NUM = 100;
final int HIGH_NUM = 499;
final double LOW_CREDITS = 0.5;
final double HIGH_CREDITS = 6;
public Course() {
// Write your code here
}
public Course(String dept, int num, double creditValue) throws CourseException {
// Write your code here
}
public String toString() {
// Write your code here
}
}
//CourseException. Java//
public class CourseException extends Exception {
public CourseException(String s) {
return
}
}
//ThrowCourseException. Java//
public class ThrowCourseException {
public static void main(String[] args) {
// Write your code here
}
}
![ansver](/tpl/images/cats/User.png)
Answers: 3
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Other questions on the subject: Computers and Technology
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 21.06.2019 21:30, khikhi1705
What elements related to the release and success of the nes console do you see in modern console releases? what elements are no longer relevant to modern console gaming?
Answers: 3
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 23:30, jamalchris9353
Worth 50 points answer them bc i am not sure if i am wrong
Answers: 1
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 00:00, Kaylaonfleek0956
Consider the series where in this problem you must attempt to use the ratio test to decide whether the series converges. compute enter the numerical value of the limit l if it converges, inf if it diverges to infinity, minf if it diverges to negative infinity, or div if it diverges but not to infinity or negative infinity.
Answers: 1
You know the right answer?
Create a CourseException class that extends Exception and whose constructor receives a String that h...
Questions in other subjects:
![Konu](/tpl/images/cats/fizika.png)
![Konu](/tpl/images/cats/mat.png)
Mathematics, 08.01.2020 05:31
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/himiya.png)
![Konu](/tpl/images/cats/mat.png)
Mathematics, 08.01.2020 05:31
![Konu](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 08.01.2020 05:31
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/biologiya.png)
Biology, 08.01.2020 05:31
![Konu](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 08.01.2020 05:31
![Konu](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 08.01.2020 05:31