Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
4th Edition
ISBN: 9780134787961
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 10, Problem 17MC
Abstract classes cannot ___________.
- a. be used as superclasses
- b. have abstract methods
- c. be instantiated
- d. have fields
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Create an abstract super class called Employee with the following attributes:
Use JavaDoc comments in the Parent and Child Classes only but use @author for the driver
name : String
and the following methods
getter and setter for the one attribute
two constructors
an abstract method called getPay()
equals()
toString()
Create a sub class of Employee called SalaryEmployee with the following attribute
yearlyPay : double
and the following methods
getter and setter for the one attribute
two constructors
getPay() that returns the yearlyPay divided by 52
equals()
toString()
Create a sub class of Employee called HourlyEmployee with the following attributes:
hoursWorked : double
payrate : double
and the following methods
getters and setters for the two attributes
two constructors
getPay() that returns the weekly pay (multiply hoursWorked by payrate - overtime included and 1.5 times payrate for hours > 40)
equals()
toString()
Create a sub class of Employee called SalesEmployee with the…
77255
Polymorphism - abstract class BankingAccount class.
Create an application with an abstract class called Account with an abstract method calculateInterest, derive the following three classes from
Account class
1. SBAccount
2. DAccount
3. FDAccount
Implement the abstract method in these classes; Invoke these methods from the main method using the reference of BankingAccount class
öclhäll daila
Declare an abstract class named A that contains:
1-A private static integer variable called C
2-A private integer variable called id
3-A constructor with no argument that sets id =
4-A public method Area() that returns 1.2
5-An abstract method getName ()
id + C
Declare a derived class from A called B that contains:
1- Two integer variables x and y
2- A constructor to initialize the fields of B class
3- Two accessor methods getx() and gety() that return the values of
- An overridden method getName() that returns the name of the class
and
y
reclare a derived class from B called Circle that contains:
- A protected double variables radius
- A constructor to initialize the fields of Circle
- An overridden method getName() that returns the name of the class
- An overridden method Area() that calculates
and B classes
and returns
the
of Circle
ite a test program to invoke the different methods declared in B and Circle classes
area
Chapter 10 Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Ch. 10.1 - Here is the first line of a class declaration....Ch. 10.1 - Look at the following class declarations and...Ch. 10.1 - Class B extends class A. (Class A is the...Ch. 10.2 - Prob. 10.4CPCh. 10.2 - Look at the following classes: public class Ground...Ch. 10.3 - Under what circumstances would a subclass need to...Ch. 10.3 - How can a subclass method call an overridden...Ch. 10.3 - If a method in a subclass has the same signature...Ch. 10.3 - If a method in a subclass has the same name as a...Ch. 10.3 - Prob. 10.10CP
Ch. 10.4 - When a class member is declared as protected, what...Ch. 10.4 - What is the difference between private members and...Ch. 10.4 - Why should you avoid making class members...Ch. 10.4 - Prob. 10.14CPCh. 10.4 - Why is it easy to give package access to a class...Ch. 10.6 - Look at the following class definition: public...Ch. 10.6 - When you create a class, it automatically has a...Ch. 10.7 - Recall the Rectangle and Cube classes discussed...Ch. 10.8 - Prob. 10.19CPCh. 10.8 - If a subclass extends a superclass with an...Ch. 10.8 - What is the purpose of an abstract class?Ch. 10.8 - If a class is defined as abstract, what can you...Ch. 10.9 - Prob. 10.23CPCh. 10.9 - Prob. 10.24CPCh. 10.9 - Prob. 10.25CPCh. 10.9 - Prob. 10.26CPCh. 10.9 - Prob. 10.27CPCh. 10.9 - Prob. 10.28CPCh. 10 - In an inheritance relationship, this is the...Ch. 10 - In an inheritance relationship, this is the...Ch. 10 - This key word indicates that a class inherits from...Ch. 10 - A subclass does not have access to these...Ch. 10 - This key word refers to an objects superclass. a....Ch. 10 - In a subclass constructor, a call to the...Ch. 10 - The following is an explicit call to the...Ch. 10 - A method in a subclass that has the same signature...Ch. 10 - A method in a subclass having the same name as a...Ch. 10 - These superclass members are accessible to...Ch. 10 - Prob. 11MCCh. 10 - With this type of binding, the Java Virtual...Ch. 10 - This operator can be used to determine whether a...Ch. 10 - When a class implements an interface, it must...Ch. 10 - Prob. 15MCCh. 10 - Prob. 16MCCh. 10 - Abstract classes cannot ___________. a. be used as...Ch. 10 - You use the __________ operator to define an...Ch. 10 - Prob. 19MCCh. 10 - Prob. 20MCCh. 10 - You can use a lambda expression to instantiate an...Ch. 10 - True or False: Constructors are not inherited.Ch. 10 - True or False: in a subclass, a call to the...Ch. 10 - True or False: If a subclass constructor does not...Ch. 10 - True or False: An object of a superclass can...Ch. 10 - True or False: The superclass constructor always...Ch. 10 - True or False: When a method is declared with the...Ch. 10 - True or False: A superclass has a member with...Ch. 10 - True or False: A superclass reference variable can...Ch. 10 - True or False: A subclass reference variable can...Ch. 10 - True or False: When a class contains an abstract...Ch. 10 - True or False: A class may only implement one...Ch. 10 - True or False: By default all members of an...Ch. 10 - // Superclass public class Vehicle { (Member...Ch. 10 - // Superclass public class Vehicle { private...Ch. 10 - // Superclass public class Vehicle { private...Ch. 10 - // Superclass public class Vehicle { public...Ch. 10 - Write the first line of the definition for a...Ch. 10 - Look at the following code, which is the first...Ch. 10 - Write the declaration for class B. The classs...Ch. 10 - Write the statement that calls a superclass...Ch. 10 - A superclass has the following method: public void...Ch. 10 - A superclass has the following abstract method:...Ch. 10 - Prob. 7AWCh. 10 - Prob. 8AWCh. 10 - Look at the following interface: public interface...Ch. 10 - Prob. 1SACh. 10 - A program uses two classes: Animal and Dog. Which...Ch. 10 - What is the superclass and what is the subclass in...Ch. 10 - What is the difference between a protected class...Ch. 10 - Can a subclass ever directly access the private...Ch. 10 - Which constructor is called first, that of the...Ch. 10 - What is the difference between overriding a...Ch. 10 - Prob. 8SACh. 10 - Prob. 9SACh. 10 - Prob. 10SACh. 10 - What is an. abstract class?Ch. 10 - Prob. 12SACh. 10 - When you instantiate an anonymous inner class, the...Ch. 10 - Prob. 14SACh. 10 - Prob. 15SACh. 10 - Employee and ProductionWorker Classes Design a...Ch. 10 - ShiftSupervisor Class In a particular factory, a...Ch. 10 - TeamLeader Class In a particular factory, a team...Ch. 10 - Essay Class Design an Essay class that extends the...Ch. 10 - Course Grades In a course, a teacher gives the...Ch. 10 - Analyzable Interface Modify the CourseGrades class...Ch. 10 - Person and Customer Classes Design a class named...Ch. 10 - PreferredCustomer Class A retail store has a...Ch. 10 - BankAccount and SavingsAccount Classes Design an...Ch. 10 - Ship, CruiseShip, and CargoShip Classes Design a...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Write an application that reads two integers, determines whether the first is a multiple of the second and prin...
Java How To Program (Early Objects)
The ____________ is always transparent.
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Sales Prediction The East Coast sales division of a company generates 65 percent of total sales. Based on that ...
Starting Out with Java: Early Objects (6th Edition)
What is denormalization?
Database Concepts (8th Edition)
If a class is named MyClass and it has a constructor, what is the constructor named? If MyClass has a destructo...
Problem Solving with C++ (9th Edition)
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)
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
- Java - Calculator Classarrow_forwardusing c# create classes and abstract class see attached questionarrow_forwardQuestion 1 O instance A class that passes its attributes and methods on to another class is referred to as a(n). subclass inheritance esc base class SAVE & CONTINUE Report an issue with this question FI F2 9.0 F3 1 2 ODD DOD F4 3 O Mark this question 4 FS 5 3..arrow_forward
- Create a class Student with following instance private variables and member functions: Variable: id (int), name (String), Major (String) Constructor: overloaded constructor Methods: Accessor/Mutator (Setter/Getters), toString Create class College with following instance variable and member function: Variable: SIZE (final and int), Student array example: Student[] student; Constructor: overloaded which take one input size and this will be the value of SIZE viable and Student array size. Methods: addStudent(id, name, major) method: This method will create and add student object to the student array and when the array gets full the method will give an error message saying that you cannot add more students searchStudent(id) method: This method uses sequential search algorithm to find a student using student id in the student array. If the student is found it will return the student object otherwise it will return null. Create class StudentSearch with the main method and the main method…arrow_forwardQUESTION 16 What must be true of a class with one abstract method? O The class must also implement the Iterable interface Any derived class must implement the method The abstract method must have the static modifier O The method cannot specify a return value QUESTION 17 Suppose we wanted to design a set of classes for a veterinarian's office. Our Customer class looks like this: public class Customer { Pet [] pets; } Select all the statements that are true Once the size of the pets array has been set, it cannot be changed Because we're using an array, all pets must be the same A customer must have at least one pet We also need to declare a Pet class QUESTION 18 What is the proper use of an enumeration? To define a set of ordered values To enforce the use of the Comparable interface O To define, or enumerate, the values returned by a Random object generator O To define the classes in an inheritance hierarchyarrow_forwardStatic nested classes doesn't have access from enclosing class. to (i) Protected members (ii) Private members (iii) Any other members (iv) Public membersarrow_forward
- 1. Create an interface OnlineQuiz with the following details: Member variables: totalMarks=10 Member Methods: · nQuestions(): An abstract method that calculates and return the number of questions. Defined in subclass. · display(): An abstract method that displays all details. Defined in a subclass. 2. Create a class Staff that inherits OnlineQuiz with the following details: Member variables: · staffD // id of the staff string type · staffName // Name of the staff string type · nMCQ // Number of MCQ type questions int type · nTF // Number of true/false type questions int type · nMatch // Number of match type questions int type Member Methods: · Define the parameterized constructor to set the member variables. · Define the method nQuestions(): which calculate and return the total number of questions. Total number of question= nMCQ + nTF +…arrow_forward/** Represents a car.*/public class Car // TODO: Inherit from Vehicle{ // Do NOT add any instance variables public Car(double purchasePrice) { // TODO: Complete } // TODO: Override the getValue methodarrow_forwardPremise: Class B is a subclass of Class A. Class C is a subclass of Class B. Is the following code valid? B b = new B(); C c = new C(); A a = b; b = c; Valid Invalidarrow_forward
- java No hand written and fast answer with explanationarrow_forwardinheritance in javaarrow_forwardInheritance and UML (Java) Design a class named Employee. The class keeps the following information in fields: - Employee Name - Employee Number in the format XXX-L, where each X is a digit within the range 0-9 and the L is a letter within the range A-M. - Hire Date - Shift (an integer) - Hourly pay rate (a double) Write one or more constructors and the appropriate accessor and mutator methods for the class. The workday is divided into two shifts: day and night. The shift field will be an integer value representing the shift that the employee works. The day shift is shift1 and the night shift is shift 2. a) Draw a UML diagram of the class. Be sure to include notation showing each field and method’s access specification and data type. Also include notation showing any method parameters and their data types. b) Write a program that demonstrates the class.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
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