introduction to object oriented programming 6

A sinusoid or sine wave is a mathematical function of the form

ð‘¦(ð‘¡) = ð´ sin(2ðœ‹ð‘“ð‘¡ + ð‘¡0) + ð‘¦0,

with four parameters:

• ð´ denotes the amplitude of the sine wave (default value: 1).
• ð‘“ denotes the frequency of the sine wave in Hz (default value: 1/2ðœ‹).
• ð‘¡0 denotes the amount of phase (horizontal) shift of the sine wave (default value: 0).
• ð‘¦0 denotes the y-offset or vertical shift of the sine wave (default value: 0).Create a class called Sinusoid with four double data fields representing the four parameters. Additionally, create the following:
• No-argument constructor Sinusoid() that creates a sinusoid with the four default parameter values.
• Constructor Sinusoid(double newAmplitude, double newFreq, double newPhase, double newYOffset) that creates a sinusoid with the user-specified parameter values.
• Method double evalAt(double t) that evaluates the y value of the sinusoid at time t.
• Method double[] evalAt(double[] tArray) that evaluates the y values of the sinusoids at thetimes in array tArray.
• Method void printFunction() that prints the functional form of the sinusoid to the console with2 decimal places for each parameter, e.g. y(t) = 2.00sin(6.28t + 0.50) + 0.10 for the sinusoid with amplitude 2, frequency 1, phase 0.5, and y-offset 0.1.Submit your source code in a file named Sinusoid.java! Do not include a main() method in your submission!

Looking for a Similar Assignment? Our Experts can help. Use the coupon code SAVE30 to get your first order at 30% off!

Hi there! Click one of our representatives below and we will get back to you as soon as possible.

Chat with us on WhatsApp