Musical notes of random duration

Assignment Help Business Management
Reference no: EM131953425

Design a Java class named Guitar that contains:

  • A private int data field named numStrings that defines the number of strings on the guitar. The default value should be 6. 
  • A private double data field named guitarLength that defines the length of the guitar in inches. The default value should be 28.2 
  • A private String data field named guitarManufacturer that defines the manufacturer of the guitar. The default value should be "Gibson". 
  • A private Color data field named guitarColor that defines the color of the guitar. The default value should be Color.Red. 
  • A no argument constructor that creates a Guitar using the default number of strings, length, manufacturer and color. 
  • A constructor that creates a Guitar using a specified number of strings, length, manufacturer and color. 

Getter methods for all data fields. 

A playGuitar() method that returns a string representation of 16 randomly selected musical notes of random duration. For example, the first part of the string returned might look like this: [A(2), G(3), B(0.5), C(1), C(1), D(0.25), ...]. You can assume one octave in the key of C where valid notes include A, B, C, D, E, F and G and duration values are .25, .5, 1, 2, and 4 representing sixteenth notes, eighth notes, quarter notes, half notes and whole notes, respectively. 

  • A toString() method that displays the number of strings, length, manufacturer and color in String format 

Be sure your code compiles. 

Design a Java test program, named TestGuitar, to create 3 different Guitars representing each representing a unique test case and call each all of the getter methods along with the toString and playGuitar() methods and document the output. For example for a Guitar with 7 strings, length of 30.2, manufactured by Fender with a color of Black, the output may look similar to this: 

***Output*** toString(): (numStrings=7, Length=30.2, manufacturer=Fender, color=Black) getNumStrings(): 7 getGuitarLength(): 30.2 getGuitarManufacturer(): Fender getGuitarColor(): Black playGuitar(): [A(2), G(3), B(0.5), C(1), C(1), D(0.25), E(2), F(2), G(0.25), C(4), C(1), F(0.25),A(1), C(2), D(4),C(4)]

Reference no: EM131953425

Questions Cloud

Designed and attractive web pages : In your opinion what are the best features of a well designed and attractive web pages and why? Justify your answer with examples.
Prepare journal entries to record current tax : FNSACC504 - Prepare financial reports for corporate entities - Prepare a classified balance sheet using the account format for San Pedro Industries
Write a paper about assessing mental illness in adolescence : Write a paper about Assessing Mental Illness in Adolescence: Bullying and Suicide. Length: 4-5 pages not including title and reference pages.
Discuss components of the general-macro environment : Discuss the characteristics of at least four (4) of the thirteen (13) components listed below. Do so in paragraph form by looking at each selected component.
Musical notes of random duration : A playGuitar() method that returns a string representation of 16 randomly selected musical notes of random duration.
Outline a system for identifying the functional areas : Outline a system for identifying the functional areas in which changes might be necessary in order to improve the hospital's service value.
What is the importance of effective communication : What is the importance of effective communication within an organization? What is the relationship between personal ethics and business ethics?
Calculate e-surfboards taxable income for the year : FNSACC504 - Prepare financial reports for corporate entities - Calculate the amount of each of E-Surfboards' temporary differences, if any, at 30 June 2014
Evaluate higher education regarding price discrimination : How and why is price discrimination offered by higher education institutions? Is this direct or indirect price discrimination?

Reviews

Write a Review

Business Management Questions & Answers

  Attractive target market to advertisers

College students have always been an attractive target market to advertisers. Today, students are becoming part of the pitch as companies recruit advocates.

  Differences between criminal and civil law

OJ Simpson was tried in criminal court in California for the 1994 murder of his ex-wife, Nicole Brown Simpson, and her friend Ronald Goldman.

  Move onward to another webpage

Okay, honesty is the best policy for this week's discussion. What makes a good web page? How do you determine if a company has a good web page or not? In other words, when do you get "bored" or "turned off" by a web page and move onward to another..

  What have the companies done right and wrong

Which company faces the worse crisis? What have the companies done right and wrong? And what can they do to restore their reputations and businesses?

  Explain bert had his driver''s license deferred by the state

Bert had his driver's license deferred by the state department of transportation. He trusts his constitutional due process rights were violated

  Database system awareness

Databases are used by nearly every operating business. They may not all be relational but data are stored, recorded, analyzed, etc. in order for any successful business to run.

  Business managementan expert in a particular business area

business managementan expert in a particular business area for example a software expert in a software development

  Ms powerpoint presentation report on organization

In this assignment, MS PowerPoint presentation that describes an organization, its current and future challenges, its capabilities, and the requisite knowledge.

  Question about health care managementshow the major

question about health care managementshow the major challenges for managing health care information technologies hcit

  Performance and career management program for

performance and career management program for employeescareer development plan part iii-performance and career

  Highest degree of trust among the players

Teams are also characterized by highest degree of trust among the players. A good team will obviously have members who are trust worthy to each other

  Limited partnership investment

Three years later, she was required to contribute $2,000 more to the partnership. Two years ago, she was required to contribute an additional $2,000. If Cameron sells her limited partnership investment today for $20,000, what are the taxes?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd