Question
For this project, please create a Java class called RadioStationException that extends Exception. RadioStationException should have a constructor that receives a radio station's call sign
For this project, please create a Java class called RadioStationException that extends Exception. RadioStationException should have a constructor that receives a radio station's call sign (for example, WJRR) and carrier frequency (for example, 101.1).
Create a second class named RadioStation that has the same fields and whose constructor requires values for both fields. Upon construction of a RadioStation object, throw a RadioStationException if the call sign does not consist of four letters or if the carrier frequency is not between 88 and 108 inclusive.
Finally, write an application that creates an array of at least six RadioStation objects by asking the user to input call signs and carrier frequencies. Display an appropriate message when a RadioStation object is created successfully and also when one is not. Be sure to test your program with valid and invalid values.
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