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

  What is the total number of parent pointers

Devise a series of equivalence statements for a collection of sixteen items that yields a tree of height 5 when both the weighted union rule and path compression are used. What is the total number of parent pointers followed to perform this series..

  Information about an economy

Let's say we have the following information about an economy. C: Consumption spending by households = $800 billion

  What problem might encounter if building kom were deleted

Given the file structure shown in Figure, what problem(s) might you encounter if building KOM were deleted?

  Design a 4-bit sign and magnitude adder

(Adder Design) Using comparators, multiplexers, and binary adder/subtractor logic blocks, design a 4-bit sign and magnitude adder (that is, one sign bit and three data bits). Include an over-flow indicator in your design.

  Data dictionary based on the list of elements

In this lab, you will prepare a Data Dictionary based on the list of elements. Also, your task will be determined the tables, their relationships, primary and foreign keys. Based on this analysis, you will create Database Schema, relational tables..

  Disaster recovery plan

What components of a disaster recovery plan should be tested?

  Responsibility of working with organization

You have been given the responsibility of working with your organization's CEO to do a competitive market analysis of the potential success.

  Managing the cisco iso files

Why do you think it's important to keep the version of IOS on your equipment up to date? How do you think you'll manage this important activity

  After how many years is the account depleted

Write an algorithm to settle the following question: A bank account starts out with $10,000. Interest is compounded monthly at 6 percent per year (0.5 percent per month). Every month, $500 is withdrawn to meet college expenses. After how many year..

  Application on law and information sharing

You likely have many friends. Although your long-time friends probably know you really well, people with whom you have formed recent friendships may know little about you. Over time, you have chosen what personal information to share with your fri..

  Objects modelled in collective outlier detection

What are the attributes, and what are the contextual and behavioural attributes? How is the relationship among objects modelled in collective outlier detection?

  What is the trouble with macro according to paul romer

What is the trouble with Macro according to Paul Romer? Be thorough and explain troublesome models and key terms such as: identification, and phlogiston.

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