Imagine you are writing some software to operate a car radio
Ask Expert

Be Prepared For The Toughest Questions

Practice Problems

Imagine you are writing some software to operate a car radio

Assignment Q3

Create a new BlueJ project called YourFirstNameLastName-A1Q3. For example, mine would be AlexHendry-A1Q3.

Imagine you are writing some software to operate a car radio. It needs to store the minimum frequency and the maximum frequency that it is capable of receiving. It also needs to know what frequency it is currently set to receive the radio waves on and it needs to store an increment amount that will be used to increase or decrease the current frequency when the user changes the radio station.

Create a class, Radio, that contains four fields, currentFrequency, frequencyChange, maxFrequency and minFrequency, all of whose type is double.

Make sure you write a description of your new Class in the comments, with your name as author and date as the last date you worked on this exercise.

Define a constructor that takes and sets the minFrequency and maxFrequency as parameters, and sets the currentFrequency to 1000.0, and frequencyChange to 1.0.

Define a second constructor that takes no parameters. The currentFrequency field should be set to the value of 1000.0 and the frequencyChange to 1.0, and maxFrequency and minFrequency to reasonable amounts.

Define the mutators increaseFrequency and decreaseFrequency, whose effect is to increase or decrease the value of currentFrequency by the frequencyChange, respectively. The mutator methods should not let the currentFrequency be set to a value higher than maxFrequency, or lower than minFrequency.

Add a mutator method that sets the value of the frequencyChange. Make sure you add a check to make sure that unrealistic values are not passed to this mutator method.

Define an accessor method to return the value of currentFrequency.

Hint
Computer The Mutator method denotes an aproach used to regulate changes to a variable inside the class. It is a class method used to change data members which best practice to make the data members private and only access them through the mutators or accessors....

Know the process

Students succeed in their courses by connecting and communicating with
an expert until they receive help on their questions

1
img

Submit Question

Post project within your desired price and deadline.

2
img

Tutor Is Assigned

A quality expert with the ability to solve your project will be assigned.

3
img

Receive Help

Check order history for updates. An email as a notification will be sent.

img
Unable to find what you’re looking for?

Consult our trusted tutors.

Developed by Versioning Solutions.