Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in java Create an enumeration called Pitch.java that represents the 12 different notes in an octave: Pitch CSHARP DSHARP FSHARP GSHARP ASHARP getOffset(): int

Code in java

image text in transcribed

Create an enumeration called Pitch.java that represents the 12 different notes in an octave: Pitch CSHARP DSHARP FSHARP GSHARP ASHARP getOffset(): int toString(): String The enum class should have add two extra methods. The first, getOffset(), returns the offset shown in the table below; Pitch. A.getOffset() should return 0, and Pitch.C.getOffset() should return -9. Note || C | C | D D'EFF GTG'ALAB Value 0 1 2 3 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 Offset - 9 -8 -7 -6 -5 -4 -3 -2 -10 1 2 Figure 11: Table of Note values and offsets The toString() method should return the note in the format "C#". That is, use a "#" symbol instead of the word "SHARP" when you print out the note. For non-sharp notes, toString() returns the same as name(). You can add private attributes and constructors to the enumeration as you see fit to make imple- menting these two methods easier

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions