Computers and Technology
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
}
}

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 23:00, bankscorneliuso39
Fast sportcars the top speeds of sportscars, given in miles per hour, are: 155 mph bmw m5 217 mph lamborghini aventador spyder 205 mph ferrari 488 205 mph nissan gtr 197 mph chevrolet corvette stingray zr1 258 mph bugatti veyron supersport 195 mph dodge viper 270 mph hennessey venom 155 mph bmw m3 195 mph mercedes sl given: topspeeds=[155; 217; 205; 205; 197; 258; 195; 270; 155; 195]; carnames=string(["bmw m5" "lamborghini aventador spyder" "ferrari 488" "nissan gtr" "chevrolet corvette stingray zr1" "bugatti veyron supersport" "dodge viper" "hennessey venom" "bmw m3" "mercedes sl"]); the variable is a rectangular array. write a function called selectcars to identify cars with the top speed within a given range, and display the identified names. the selected cars speed will be in a range given by lowerbound < speed < upperbound. inputs to the function selectcars are: a column array os all car top speeds named topspeeds, the corresponding chara
Answers: 2
image
Computers and Technology, 22.06.2019 19:00, dadonelson2109
If your accelerator suddenly gets stuck what should you do
Answers: 2
image
Computers and Technology, 23.06.2019 01:00, lusciousl
Petrică, tânăr licean în clasa a ix-a, a primit în dar de la părinţii săi un cont bancar pentru micile sale cheltuieli curente. el este pasionat de internet banking şi îşi verifică cu grijă toate tranzacţiile efectuate. pentru creşterea securităţii tranzacţiilor online, banca îi furnizează lui petrică un număr pe care el va trebui să îl modifice, obţinând un număr tan – număr de autentificare a tranzacţiei (transaction authentication number). regula de obţinere a numărului tan este următoarea: se formează cel mai mic număr par din toate cifrele numărului furnizat de bancă. cerinţă cunoscând numărul n furnizat de bancă, să se determine numărul tan obţinut de petrică. date de intrare fişierul tan. in conţine pe prima linie numărul natural n cu semnificaţia din enunţ. date de ieşire fişierul de ieşire tan. out va conţine o singură linie pe care va fi scris numărul tan cerut. restricţii • 0 < n < 18*1018 • n are cel puţin o cifră pară • numărul tan obţinut nu poate conţine zerouri nesemnificative
Answers: 2
image
Computers and Technology, 23.06.2019 03:00, jarteria0
State 7 common key's for every keyboard
Answers: 1
Do you know the correct answer?
Create a CourseException class that extends Exception and whose constructor receives a String that h...

Questions in other subjects: