8a. Create a class named Tape that includes fields for length and width in inche
ID: 3634749 • Letter: 8
Question
8a. Create a class named Tape that includes fields for length and width in inches, and create get and set methods for each field.8b. Derive two subclasses – VideoCassetteTape and AdhesiveTape. The ViedeoCassetteTape class includes a numeric field to hold playing time in minutes and get and set methods for that field. The AdhesiveTape class includes a numeric field that holds a stickiness factor – a value from 1 to 10 – and get and set methods for the field.
8c. Design a program that uses the classes and instantiates one object of each of the three classes, and demonstrate using all the methods defined for each class.
In addition create the following:
a. A UML class diagram showing classes (their class name, instance variables, method names, visibility, arguments, return type) and their relationships. (Use figures in the text starting on p. 560 as a guide, realizing that you will need to pick the right ones depicting inheritance. The relationship you will model will depict generalization.
Deliverables: Create and turn-in the following as a Word document:
1. Class diagram showing all classes, relationship, etc.
2. Pseudocode for all class methods as well as the program of 8c. Write pseudocode (using the book’s format) for all methods.
Explanation / Answer
Create a class named Tape that includes fields for length and width in inches, and create get and set methods for each field. class Tape { private int length; private int width; Tape() { } int getlength() { return length; } int getwidth() { return width; } void setlength(int l) { length = l; } int setwidth(int w) { width = w; } }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.