Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For each pair of specifications below, state whether the extending class is a true subtype of its superclass or not. Explain your answer. 1. class

For each pair of specifications below, state whether the extending class is a true subtype of its superclass or not. Explain your answer.

 1. class Bicycle { int cadence; int speed; int gear; // effects: creates a new Bicycle Bicycle(int startCadence, int startSpeed, int startGear); // modifies: this // effects: this_post.cadence=newCadence, this_post.speed=newSpeed, this_post.gear=newGear void setParameters(int newCadence, int newSpeed, int newGear); } class MountainBike extends Bicycle { int height; // effects: creates a new MountainBike MountainBike(int startCadence, int startSpeed, int startGear, int startHeight); // modifies: this // effects: this_post.height=newHeight void setHeight(int newHeight); } 
2. class Account { // modifies: this // effects: this_post.amount = this_pre.amount + d; void deposit(int d); } /* An account that works safely when multiple transactions attempt deposits simultaneously */ class ConcurrentAccount extends Account { // modifies: this // effects: this_post.amount = this_pre.amount + d; // throws: AbortException if another transaction is in the process of depositing money void deposit(int d); } 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions