Starting Out with Python (3rd Edition)
3rd Edition
ISBN: 9780133743692
Author: GADDIS
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 11, Problem 3MC
Suppose a program uses two classes: Airplane and Jumbo Jet. Which of these would most likely be the subclass?
a. Airplane
b. JumboJet
c. Both
d. Neither
Expert Solution & Answer
Learn your wayIncludes step-by-step video
schedule02:47
Students have asked these similar questions
Create a class Course, which has one field:
String courseName
Create the constructor, accessor, and mutator for the class. Then, in the main method of this class, create an instance of the class with the name "CST1201".
Write an equivalent while statement to replace the following for statement
for (int i=2; i<100; i=i+2) {
System.out.println(i);
}
Create a Class Pet with the following data members
Identification: String
species : String (e.g. cat, dog, fish etc)
breed: String
Age (in days): int
Weight: float
Dead: boolean
1. Provide a constructor with parameters for all instance variables.
2. Provide getters for all and setters for only breed, and weight
3. Provide a method growOld() that increases the age of the pet by one day. A dead pet wont grow old
4. Provide a method growHealthy(float w) that increases the weight of the pet by the given amount w. A dead pet cannot grow healthy.
5. Provide a method fallSick(float w) that reduces the weight of the pet by the given amount. The least weight a pet can have is 0 which will mean that the pet has died. If the value of weigh is 10 kg and the method is called with an argument of 11 kg then you will set it to 0 and set the dead to an appropriate value to mark the death of the pet
6. Provide a toString method that shows an appropriate well formatted string…
Suppose you have defined a class such as the following for use in a program:public class YourClass{private int information;private char moreInformation;public YourClass(int newInfo, char moreNewInfo){<Details not shown.>}public YourClass(){
Chapter 11 Solutions
Starting Out with Python (3rd Edition)
Ch. 11.1 - In this section, we discussed superclasses and...Ch. 11.1 - Prob. 2CPCh. 11.1 - What does a subclass inherit from its superclass?Ch. 11.1 - Look at the following code, which is the first...Ch. 11.2 - Look at the following class definitions: class...Ch. 11 - In an inheritance relationship, the ___________ is...Ch. 11 - In an inheritance relationship, the _________ is...Ch. 11 - Suppose a program uses two classes: Airplane and...Ch. 11 - This characteristic of object-oriented programming...Ch. 11 - Prob. 5MC
Ch. 11 - Polymorphism allows you to write methods in a...Ch. 11 - It is not possible to call a superclasss _ _init_...Ch. 11 - A subclass can have a method with the same name as...Ch. 11 - Only the _ _init_ _method can be overridden.Ch. 11 - You cannot use the isinstance function to...Ch. 11 - What does a subclass inherit from its superclass?Ch. 11 - Look at the following class definition. What is...Ch. 11 - Prob. 3SACh. 11 - Write the first line of the definition for a...Ch. 11 - Look at the following class definitions: class...Ch. 11 - Look at the following class definition: class...Ch. 11 - Employee and ProductionWorker Classes Write an...Ch. 11 - ShiftSupervisor Class In a particular factory, a...Ch. 11 - Person and Customer Classes The Person and...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Dynamic String Stack Design a class that stores strings on a dynamic stack. The strings should not be fixed in ...
Starting Out with C++ from Control Structures to Objects (9th Edition)
The decimal number 17 is equal to the binary number 10010 11000 10001 01001
Digital Fundamentals (11th Edition)
Suppose your code creates an object of the class Scanner named keyboard (as described in this chapter). Write c...
Absolute Java (6th Edition)
Which category of C++ reference variables always produces aliases?
Concepts Of Programming Languages
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
Which loop should you use when you know the number of required iterations?
Starting Out with Java: From Control Structures through Objects (6th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- For your homework assignment, build a simple application for use by a local retail store. Your program should have the following classes: Item: Represents an item a customer might buy at the store. It should have two attributes: a String for the item description and a float for the price. This class should also override the __str__ method in a nicely formatted way. Customer: Represents a customer at the store. It should have three attributes: a String for the customer's name, a Boolean for the customer's preferred status, and a list of 5 indexes to hold Item objects. Include the following methods: make_purchase: accepts a String and a double as parameters to represent the name and price of an item this customer is purchasing. Create a new Item object with this info and append it to the internal list. If the customer is a preferred customer based on the Boolean attribute's value, take 10% off the total sale price. __str__: Override this method to print the customer's name and every…arrow_forwardImplement a new class Contact :public Person I provided person.h you don't have to touch person.h just need help on contact.h class public person and private person please help mearrow_forwardCreate a car rental system where customers rent cars for a given period of time. You are given the following classes: Car– a class that has the following properties: car type: Mrcedes, Opel, Fiat, ....etc.. car license end date. car number. Necessary constructor and getters/setters. Small car class– inherits from the car and has the following constants: 4 passengers, Motor 1200, air-conditioner. Medium car class– inherits from the car and has the following constants: 4 passengers, Motor 1400, air-conditioner, Speed Control. Large car class- inherits from car and has the following constants: 6 passengers, Motor 1600, air-conditioner, speed control, Wi-Fi. Customer class: holds first name, last name and id number as member variables (of course with necessary constructor, getters and setters) . Rent class (representing the time period when the car is rent): holds startDate and endDate, rent price (of course with necessary constructor, getters and setters). In…arrow_forward
- Write the following Book class:A Book has-a title, ISBN number, author and price.o Include the following:o All instance fields (variables)o Two Constructors: a default constructor and onerequiring all fields as parameterso Methods – an accessor and mutator for each instancefieldso Create two Book objects with title, isbn, author andpriceo Print the information about the bookso Change the price of both books.o Reprint the information about the booksarrow_forward1) Write a class called Room, which has three private instance variables: a) a double width, representing the width of the room in feet, b) a double length, representing the length of the room in feet, and c) an int floor, representing the building floor that the room is on. 2) Write a default constructor for the class Room that sets the width to 10, the length to 12.5, and the floor to 1. 3) Write get and set methods (“getters” and “setters”) for the three instance variables. For the set methods for the width and length, only positive values should be set. If the input is 0 or a negative number, the variables should not be changed. 4) Write a constructor for the class Room that takes in two double parameters and an int, and sets length to the larger double, width to the smaller double, and floor to the int. Use the setters from part (b). 5) Override the default toString method for the class Room, so when called by an instance of Room created by the default constructor from part (a)…arrow_forward1/ Write a BankAccountTester class whose main method constructs a bank account, deposits $1,000, withdraws $500, withdraws another $400, and then prints the remaining balance. Also print the expected result 2/ Implement a class Employee. An employee has a name (a string) and a salary (a double). Provide a constructor with two arguments public Employee(String employeeName, double currentSalary) and methods public String getName() public double getSalary() public void raiseSalary(double byPercent) These methods return the name and salary, and raise the employee's salary by a certain percentage. Sample usage: Employee harry = new Employee("Hacker, Harry", 50000); harry.raiseSalary(10); // Harry gets a 10 percent raise Supply an EmployeeTester class that tests all methods. 3/Implement a class Car with the following properties. A car has a certain fuel efficiency (measured in miles/gallon or liters/km—pick one) and a certain amount of fuel in the gas tank. The efficiency is specified in…arrow_forward
- Can it be two classes, the Calculator class must instantiate the CalculatorFrame class and the CalculatorFrame class must be where the calculator gets built.arrow_forwardConsider the following Student Class An. EngineeringStudent "is-a" Student whose major is Engineering. In additional to the name, number of credit hours, and GPA, an Engineering electrical, computer, etc. Write the complete defoe the Engineeringstudent class including the implementation of the methods.arrow_forwardSuppose that you are in charge of customer service for a certain business. As phone calls come in, the name of the caller is recorded and eventually a service representative return the call and handles the request.Write a class ServiceRequests that keeps track of the names of callers. The class should have the following methodsarrow_forward
- What is the output of the following code where Student is a subclass of Person class? Person s = new Student(); if (s instanceof Student) { System.out.print("This is a student ”); } else { System.out.print("This is a person ”); } This is a student This is a person This is a student This is a person Syntax errorarrow_forwardWrite a code for a banking program.a) In this question, first, you need to create a Customer class, this class should have:• 2 private attributes: name (String) and balance (double)• Parametrized constructor to initialize the attributes• Methods:i. public String toString() that gives back the name and balanceii. public void addPercentage; this method will take a percentage value andadd it to the balanceb) Second, you will create a driver class and ask the user to enter 6 customers’ informationand then you will create an array of Customer objects.c) Then you use this array used for various operations as shown in the output.• Using the array of customer objects, you need to search for all customers whohave less than $150• Using the array of customer objects, you need to get the average balance of thebalances in this array• Using the array of customer objects, you need to get the customer with thehighest balance and lowest balance• Using the array of customer objects, you need to show all…arrow_forwardDesign a class that holds the following personal data:name, address, age, and phone numbers. Writeappropriate accessor, mutator methods. Demonstrate theclass by writing a program that creates three instances ofit. One instance should hold you’re your information, andthe other two should hold your friends’ or familymembers’ information.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY