Displays the number of strings

Assignment Help Basic Computer Science
Reference no: EM131955202

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: 

Reference no: EM131955202

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.
When should safety and health training begin with a employee : When should safety and health training begin with a new employee? Which of the following is NOT one of the three types of behavior?
Contribute at the time of the wedding to cover its cost : how much will he need to contribute at the time of the wedding to cover its cost?
Write a paper about an administrations assistant employer : Write a paper about an administrations assistant employer for refugees. the resources must come credible websites for refugees.
Displays the number of strings : A toString() method that displays the number of strings, length, manufacturer and color in String format
Analysis - Demand and supply of ANY resources in Australia : HI5003 Economics for Business Assignment - Newspaper Analysis (Written Report). Demand and supply of ANY resources in Australia which includes human resource
What is the total carrying cost-what is the restocking cost : What is the total carrying cost? What is the restocking cost? Should Trektronics increase or decrease its order size?
Write and discuss about the amazon at australia : Write and discuss about the Amazon at Australia.Also Describe the give points :
Star schema for simplified automobile insurance company : You are to construct a star schema for Simplified Automobile Insurance Company. The relevant dimensions, dimension attributes, and dimension sizes are as follow

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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