Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

8a. Create a class named Tape that includes fields for length and width in inche

ID: 3635014 • 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.

Explanation / Answer

Dear user,


8a) Pseudocode:


class Tape
Declarations
private num tapeLength
private num tapeWidth

public void setTapeLength(num number)
tapeLength=number
return

public void setName(string name)
tapeWidth=name
return

public num getTapeLength( )
return tapeLength

public string getName( )
return tapeWidth

public string toString()
Declarations
string output
output=”Tape length :”, tapeLength, ”Tape width:”, tapeWidth
return
endClass
--------------------------------------------------------------------------------------
8b) Pseudocode:
class VideoCassetteTape inherits From Tape
     Declarations
          private num playingTime
    
     public void setPlayingTime(num time)
         playingTime=time
     return

    public num getPlayingTime()
    return playingTime

   public string toString()
       Declarations
           string output
            output=”Playing Time:”, playingTime  
             return
endClass
----------------------------------------------------------------------------------------------

class AdhesiveTape inherits From Tape
    Declarations
       private num sticknessFactor
  
     public num getSticknessFactor()
           return sticknessFactor
  
    public void setSticknessFactor(num SticknessFactor from 1 to 10)
        sticknessFactor=SticknessFactor
    return

   public string toString()
       Declarations
           string output
            output= “Stickness Factor ”,sticknessFactor  
             return
endClass

--------------------------------------------------------------------------------------------------
8c) Pseudocode:
start
     Declarations
            Tape Tape1
            VideoCassetteTape Tape2
            AdhesiveTape Tape3

     Tape1.setName(“Martin”)
     output “Tape name:”, Tape1.getName()

    Tape2.setName(“Williams”)
    Tape2.setPlayingTime (200)
   output “ “Tape name:”, Tape2.getName(),
                “Playing Time:”,Tape2.getPlayingTime( )

    Tape3.setName(“Reena”)
    Tape3. setSticknessFactor (30)
   output “Tape name:”, Tape3.getName(),
                “Stickness factor: ”,Tape3. getSticknessFactor( )
stop

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote