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
}
}
Answers: 3
Computers and Technology, 22.06.2019 10:30
You have a large, late-model pick-up truck with a rear seat. the pick-up truck weighs 6,500 pounds. the florida seat belt law
Answers: 1
Computers and Technology, 22.06.2019 13:30
Write lines of verse that rhyme to remember the following information: acid rain is a type of air pollution caused by chemicals in the air.
Answers: 1
Computers and Technology, 22.06.2019 20:00
Awide variety of “ apps “ are available to customize devices. which category of app does the word processing software fall into?
Answers: 2
Computers and Technology, 22.06.2019 23:30
In my email i got a message it says a quick message and in message details on who its from its says nicole and under nicole is [email protected] -
Answers: 1
Create a CourseException class that extends Exception and whose constructor receives a String that h...
Physics, 13.12.2019 05:31
History, 13.12.2019 05:31
Mathematics, 13.12.2019 05:31