EBK STARTING OUT WITH VISUAL C#
4th Edition
ISBN: 9780134400433
Author: GADDIS
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 10, Problem 5MC
Derived classes are sometimes called______________ .
- a. refined classes
- b. subclasses
- c. child classes
- d. neoclasses
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
The Rectangle class) Following the example of the Circle class in Section 9.2, design a class named Rectangle to represent a rectangle. The class contains: ■ Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height. ■ A no-arg constructor that creates a default rectangle. ■ A constructor that creates a rectangle with the specified width and height. ■ A method named getArea() that returns the area of this rectangle. ■ A method named getPerimeter() that returns the perimeter.Draw the UML diagram for the class and then implement the class. Write a test program that creates two Rectangle objects—one with width 4 and height 40and the other with width 3.5 and height 35.9. Display the width, height, area, and perimeter of each rectangle in this order.
Create a base class called “Animal” which has two (2) class fields. The first field holds an integer “IDtag” for a number that a zoo uses to catalogue their animals and the second field holds a string called “species.”From the Animal class, derive two (2) classes. One is called “Bird” and the other “Reptile”. E.g. Species could be (for the Bird class) ostrich, dove, chicken etc. and (for the Reptile class) lizard, snake, bearded dragon etc.The Bird class has an additional class field called “colour” which holds the colour of the birds feathers (int – 1=grey, 2=white, 3=black). The reptile class has an additional class field called “bloodTemp” which hold the reptile’s temperature of their blood (double).You need to instantiate two (2) objects. The bird object will be called “brd” and the reptile object called “rept.”Input values for the bird’s IDtag, species and feather colour (int) and for the reptile’s IDtag number, species and bloodTemp. Override the Animal class’s input and output…
Assume we have a class called Phone with variables size, weight, type, It has a string array called apps, and a variable called number_of_apps. A subclass is called SumsangPhone, which has a variable called operating_system. Write the
constructor for the Sumsang Phone.
Chapter 10 Solutions
EBK STARTING OUT WITH VISUAL C#
Ch. 10.1 - In this section, we discussed base classes and...Ch. 10.1 - Prob. 10.2CPCh. 10.1 - What does a derived class inherit from its base...Ch. 10.1 - Look at the following code, which is the first...Ch. 10.1 - Briefly summarize the constructor issues in...Ch. 10.2 - Look at the following class definitions: class...Ch. 10.2 - Does the is a relationship work in reverse? Why or...Ch. 10.3 - What is the purpose of an abstract class?Ch. 10.3 - If a class is abstract, what cannot be done with...Ch. 10.3 - If a class is derived from a base class that has...
Ch. 10.3 - What must be done with an abstract property before...Ch. 10.3 - How can you create an abstract read-only property?Ch. 10 - When one object is a specialized version of...Ch. 10 - In an inheritance relationship, the_______ is the...Ch. 10 - In an inheritance relationship, the___________ is...Ch. 10 - Base classes are sometimes called____________. a....Ch. 10 - Derived classes are sometimes called______________...Ch. 10 - The refers to the base class. a. friend keyword b....Ch. 10 - Prob. 7MCCh. 10 - When a derived class method has the same name as a...Ch. 10 - The declares that a derived class is allowed to...Ch. 10 - The declares that this method overrides a method...Ch. 10 - A class that is not intended to be instantiated,...Ch. 10 - To declare a class as abstract, you use the...Ch. 10 - A regular, nonabstract class is sometimes called a...Ch. 10 - A(n) __________ is a method that appears in a base...Ch. 10 - A(n) __________ is a property that appears in a...Ch. 10 - __________ allows a base class reference variable...Ch. 10 - The base class inherits fields, properties, and...Ch. 10 - Polymorphism allows a class variable of the base...Ch. 10 - Properties in a base class cannot be overridden in...Ch. 10 - A base class reference variable can reference an...Ch. 10 - A statement that tries to use the new operator to...Ch. 10 - A class that is not intended to be instantiated,...Ch. 10 - When an abstract property appears in a class, it...Ch. 10 - What does a derived class inherit from its base...Ch. 10 - Look at the following code, which is the first...Ch. 10 - Can methods in the derived class directly access...Ch. 10 - When you create an instance of a derived class,...Ch. 10 - In what kind of situation would you want to use an...Ch. 10 - What is primary difference between an abstract...Ch. 10 - Can abstract classes also contain abstract...Ch. 10 - Write the first line of the definition for a...Ch. 10 - Look at the following class declarations: class...Ch. 10 - Write a parameterized constructor for a base class...Ch. 10 - Prob. 4AWCh. 10 - Create an abstract class called Star. Include an...Ch. 10 - Employee and ProductionWorker Classes Create an...Ch. 10 - ShiftSupervisor Class In a particular factory, a...Ch. 10 - TeamLeader Class In a particular factory, a team...Ch. 10 - Person and Customer Classes Design a class named...Ch. 10 - PreferredCustomer Class A retail store has a...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
When displaying a Java applet, the browser invokes the _____ to interpret the bytecode into the appropriate mac...
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
What will the following code display? number 1 = 10 number 2=5 number 1 = number 1 + number 2 print(number1) pr...
Starting Out with Python (3rd Edition)
A number x is divisible by y if the remainder after the division is zero. Write a program that tests whether on...
Java: An Introduction to Problem Solving and Programming (7th Edition)
Write a program that calculates the sum of the digits of an integer. For example, the sum of the digits of the ...
Programming in C
T F: A local variable may be accessed by any other procedure in the same Form file.
Starting Out With Visual Basic (8th Edition)
(Arithmetic, Largest Value and Smallest Value) Write a program that inputs three different integers from the ke...
C How to Program (8th 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
- Write a program named SalespersonDemo that instantiates objects using classes named Real EstateSalesperson and GirlScout. Demonstrate that each object can use a SalesSpeech() method appropriately. Also, use a MakeSale() method two or three times with each object, and display the final contents of each objects data fields. First, create an abstract class named Salesperson. Fields include first and last names; the Salesperson constructor requires both these values. Include properties for the fields. Include a method that returns a string that holds the Salespersons full name—the first and last names separated by a space. Then perform the following Create two child classes of Salesperson: Real EstateSalesperson and Girl Scout. The Real EstateSalesperson class contains fields for total value sold in dollars and total commission earned (both of which are initialized to 0), and a commission rate field required by the class constructor. The Girl Scout class includes a field to hold the number of boxes of cookies sold, which is initialized to 0. Include properties for every field. Create an interface named ISell able that contains two methods: SalesSpeech() and MakeSale(). In each Real EstateSalesperson and Girl Scout class, implement SalesSpeech() to display an appropriate one- or two-sentence sales speech that the objects of the class could use. In the Real Estatesalesperson class, implement the MakeSale() method to accept an integer dollar value for a house, add the value to the Real EstateSalespersons total value sold, and compute the total commission earned. In the Girl Scout class, implement the MakeSale() method to accept an integer representing the number of boxes of cookies sold and add it to the total field.arrow_forwardA. Create a BankAccount class. We want to be able to create a new bank account, make deposits and withdrawals, and check the balance. Each bank account created should receive a unique account id, numbered sequentially 1001, 1002, 1003, and so on. We should be able to change the name on the account. We should also be able to retrieve the account id and the name on the account. Provide a constructor that takes a name for the account as a parameter. Remember that a constructor has the same name as the class. The constructor should initialize all of the instance variables. What does the class need to remember? Those are the instance variables. There should be three. Provide the following methods: public double getID() gets the account id of this BankAccount public double getBalance() gets the balance of this BankAccount public String getName() gets the name of this BankAccount public void setName(String newName) sets a new name for this BankAccount public void deposit(double…arrow_forwardThe classes DateInfo and Student in different packages 1. Create two packages, calendar, and personal_data 2. Create a class called DateInfo inside the package calendar 3. The class DateInfo has only three variables, day (type integer), month (integer), year (integer). 4. The three variables day, month and year, are invisible outside the class DateInfo. 5. Define a constructor for the class DateInfo with three-arguments to initialize the variables day, month and year. 6. Write a method called getDateFormat, that returns a date format example; 19/4/2016 (the method returns a String type for simplification) 7. Create a class called Person inside the package personal_data. 8. The Person class has only two variables, name (type String) and birthDate (type DateInfo). 9. Create two Person objects for Omar and Rami, Omar's birthDate is 28/8/1998 and Rami's birthDate is 13/9/1996arrow_forward
- write a class called OneItemBag ( OneItemBag.java ). This class represents a bag that can hold any single type of object (decided at bag-creation time), and only one item of that type at a time. You may have a zero-parameter constructor if you want one, but you must have the following three features:1. a method that puts an item in the bag (addItem()) which returns whether or not it was successfully added2. a method that removes an item from the bag and returns it (removeItem()), return null if there is no item3. a method to check if an item is in the bag (hasItem()) which returns true or falsearrow_forward(The Rectangle class) Following the example of the Circle class in Section 8.2,design a class named Rectangle to represent a rectangle. The class contains:■ Two double data fields named width and height that specify the width andheight of the rectangle. The default values are 1 for both width and height.■ A no-arg constructor that creates a default rectangle.■ A constructor that creates a rectangle with the specified width and height.■ A method named getArea() that returns the area of this rectangle.■ A method named getPerimeter() that returns the perimeter.Draw the UML diagram for the class and then implement the class. Write a testprogram that creates two Rectangle objects—one with width 4 and height 40and the other with width 3.5 and height 35.9. Display the width, height, area,and perimeter of each rectangle in this order.arrow_forwardCreate a class called Employee as a a derived class of the class Person. An employee record has an employee's name, address, gender(inherited from the class Person), an ID number whose type is String, an annual salary represented as a single value of type double, and a year the employee started work as a single value of type int. Your class should have a reasonable number of constructors and setter methods, as well as getter methods. Write another class containing a main method to fully test your class definition.arrow_forward
- Create a class called Employee as a a derived class of the class Person. An employee record has an employee's name, address, gender(inherited from the class Person), an ID number whose type is String, an annual salary represented as a single value of type double, and a year the employee started work as a single value of type int. Your class should have a reasonable number of constructors and setter methods, as well as getter methods. Create another class containing a main method to fully test your class definition.arrow_forwardCreate a class called Employee as a a derived class of the class Person. An employee record has an employee's name, address, gender(inherited from the class Person), an ID number whose type is String, an annual salary represented as a single value of type double, and a year the employee started work as a single value of type int. Your class should have a reasonable number of constructors and setter methods, as well as getter methods. Create another class containing a main method to fully test your class definition. programming language to be used is javaarrow_forward{In Java Programming Please} Create a class hierarchy that represents different types of employees in a company. Start with a class called Employee that has two methods: calculateSalary() and displayDetails(). Then, create two subclasses of Employee: Manager and Engineer. Override the calculateSalary() method in both subclasses to calculate the salary based on their job role and experience. Override the displayDetails() method in both subclasses to print out a message indicating the details of the employee. Next, create another class called Salesperson that extends Employee and has a method called calculateCommission(). Create two subclasses of Salesperson: SeniorSalesperson and JuniorSalesperson. Override the calculateCommission() method in both subclasses to calculate the commission based on their sales performance. Override the displayDetails() method in both subclasses to print out a message indicating the details of the salesperson. In the main method, create objects of each class…arrow_forward
- "Create a class named Rock that acts as a superclass for rock samples collected and catalogued by a natural history museum. The Rock class contains fields for a number of samples, a description of the type of rock, and the weight of the rock in grams. Include a constructor that accepts parameters for the sample number and "weight. The Rock constructor sets the description value to Unclassified. Include get methods for each field. Create three child classes named IgneousRock, SedimentaryRock, and MetamorphicRock. The constructors for these classes require parameters for the sample number and weight. Search the Internet for a brief description of each rock type and assign it to the description field. Create an application that instantiates an object of each type and demonstrate that the methods work appropriately. Save the files as Rock.java, IgneousRock.java,SedimentaryRock.java, MetamorphicRock.java, and DemoRocks.java."arrow_forwardin Java Part 1 : Start by creating a new class called MyPoint that can be initialized with either of these constructors: MyPoint p1 = new MyPoint(); MyPoint p2 = new MyPoint(2.0, 4.0); The two arguments given to the constructor are x (2.0) and y (4.0) co-ordinates. Don’t forget to include getters and setters as these should be private instance variables! Part 2 : Create a toString() instance method that prints out the co-ordinates of the point. Add two instance methods that return the Euclidean distance to another point, or to another (x, y) coordinate. Example: double distance = p2.distance(p1); The Euclidean distance between two points is: d=√x^2 + y^2 You will need to make use of methods from the Math package: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Math.html Test your constructors and the new methods. Part 3 : Create a class method, contains(MyPoint[] points, MyPoint p), that checks if the point p is in the array points and returns a boolean.…arrow_forwardJAVA HELP! Can you add questions and covert chapter numbers into points and make an application that calls them over 100? Create a new NetBeans 8.2 Java 8 project called TestSimulator.Add the eight classes from the UML class diagram in a package called “testsimulator” as shown below. Create a class stub for each class such as below:public class ClassName { }Add the necessary additional keywords for classes that inherit from interfaces or abstract classes.Part 2:Main menu Consult the UML class diagram and add implementation to the TestSimulator class as follows:getSelection() method: • Print the following menu-based messages:Welcome to the TestSimulator program menu.Select from one of the following options.(1) New test. (2) Test summary. (3) Exit. Enter your selection:• Accept the choice from the user. • Ask the user to enter their choice again if a non-number is received.main() method: • Add a loop that runs the getSelection() method until the user enters option (3). • Add a…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
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,
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