Starting out with Visual C# (4th Edition)
4th Edition
ISBN: 9780134382609
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 10, Problem 13MC
A regular, nonabstract class is sometimes called a __________.
- a. true class
- b. model class
- c. concrete class
- d. real class
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
A class that is not intended to be instantiated, but used only as a base class, is called a(n) __________. a. dummy class b. subclass c. virtual class d. abstract class
Given the following super class and subclasses:
public abstract class ThemePark
String name: // customer's name
String icNo: // customer's identification card number
boolean member: // either member or nonmember of the
// theme park
//Methods:
//default and normal constructor
//accessors
//toString0
public abstract double calCharges0: //calculate the charges
public class WaterPark extends ThemePark
String activity: // surfBeach,waterRide or other
//Methods:
//default and normal constructor
//accessors
/toString0
public double calCharges) .
public class WildlifePark extends ThemePark
String category: //child or adult
I/Methods:
//default and normal constructor
//accessors
/toString)
public double calCharges) .)
b) Write code fragments in the application / driver class that can perform the following tasks:
(Assume all relevant methods have been defined in all classes involved)
ii) Assuming data has been stored in this tp array, calculate and display the total charges of every WaterPark…
A class called Author is designed to model a book's author. It contains:• Three private instance variables: name (String), email (String), and gender (char of either'm' or 'f');• An __init__() to initialize the name, email and gender with the given values• Getters/Setters: getName(), getEmail(), setEmail(), and getGender()(There are no setters for name and gender, as these attributes cannot be changed.)• A __str__() method that returns printable string of that object with the following format:"Author[name=?,email=?,gender=?]"e.g., "Author[name=Tan Ah Teck,email=ahTeck@somewhere.com,gender=m]".Write the Author class. Also write a test driver code to test all the public functions, e.g.,ahTeck = Author("Tan Ah Teck", "ahteck@nowhere.com", 'm') # Test the constructorprint(ahTeck) # Test __str__()ahTeck.setEmail("paulTan@nowhere.com") # Test setterprint("Name is: ", ahTeck.getName()) # Test getterprint("Email is: ", ahTeck.getEmail()) # Test getterprint("Gender is: ", ahTeck.getGender()) #…
Chapter 10 Solutions
Starting out with Visual C# (4th Edition)
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
Describe a method that can be used to gather a piece of data such as the users age.
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Before GUIs became popular, the _____ interface was the most commonly used. a. command line b. remote terminal ...
Starting Out with Programming Logic and Design (4th Edition)
Identify the important constituents of the control mechanism in the routines of the previous problem. In partic...
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
The do-while loop is this type of loop. a. pretest b. posttest c. prefix d. postfix
Starting Out with Java: From Control Structures through Objects (6th Edition)
An object is a(n) ________. a. blueprint b. primitive data type c. variable d. instance of a class
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
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
- Design a class named Employee. The class should keep the following information infields:• Employee name• Employee number in the format XXX-L, where each X is a digit within the range0-9 and the Lis aletter within the range A-M.• Hire date* Write one or more constructors and the appropriate accessor and mutator methods for theclass.Next, write a class named ProductionWorker that extends the Employee class. TheProductionWorker class should have fields to hold the following information:• Shift (an integer)• Hourly pay rate (a double)The workday is divided into two shifts: day and night. The shift field will be an integer valuerepresenting the shift that the employee works. The day shift is shift 1 and the night shift isshift 2. Write one or more constructors and the appropriate accessor and mutator methodsfor the class. Demonstrate the classes by writing a program that uses a ProductionWorkerobject. have to use beginner code because this is an intro class.arrow_forwardGiven the following super class and subclasses: public abstract class ThemePark String name: // customer's name String icNo: // customer's identification card number boolean member: // either member or nonmember of the // theme park I/Methods: //default and normal constructor //accessors //toStringo public abstract double calCharges0: //calculate the charges public class WaterPark extends ThemePark String activity: // surfBeach,waterRide or other //Methods: //default and normal constructor //accessors //toString0 public double calCharges() public class WildlifePark extends ThemePark String category: //child or adult //Methods: //default and normal constructor //accessors //toString) public double calCharges) .) a) Write the following method definition (the coding): i) Normal constructor for both subclasses. 2014 - 2021arrow_forward1. Create abstract class Pet , which is the abstract super class of all animals.1. Declare an integer attribute called legs, which records the number of legs for this animal.2. Define a constructor that initializes the legs attribute.3. Declare an abstract method eat.4. Declare a concrete method walk that prints out something about how the animals walks (include the number of legs).2. Create the Dog class that implements Pet class.1. This class must include a String attribute to store the name and food of the pet2. Define a default constructor that calls the super class constructor to specify that all dogs have 4 legs and name.3. override the eat and walk method.3. Create the Cat class that Implements Pet class.1. This class must include a String attribute to store the name of the pet, and a string to save food .2. Define a constructor that takes one String parameter that specifies the cat's name. This constructor must also call the super class constructor to specify that all cats have…arrow_forward
- Create an Employee Class with the ff: attributes: = String name = double salary = String birthday = __init__(self, name, salary, birthday) = String getDetails() -- returns a String value that represents all the information of the Employee object Create a Manager class that inherits Employee, a Manager will also have the ff: = String department = __init__(self, name, salary, birthday, department) = String getDetails() -- returns a String value that represents all the information of the Manager object Create a Director class that inherits Manager, a Director will also have the ff: = double carAllowance = __init__(self, name, salary, birthday, department, carAllowance) = def playGolf() -- will print a string value '{name of director} plays golf' = String getDetails() -- returns a String value that represents all the information of the Director object Create 2 objects of each class and call their respective getDetails() method. Do not write WET codes, be sure there's no…arrow_forwardCreate the a Person class with the following:Class VariablesString firstnameString lastnameint birthmonthint birthdayint birthyearString ssnAll variables above should be private.ConstructorThe main constructor should take in all values and assign them to their respective private class variablesMethodsCreate a public getters and setters for firstname and lastname and SSNgetFirstnamegetLastnamesetFirstnamesetLastnameCreate a public getter method called getBirthdate, which will return a String composed of their birthday in month/day/year format. For example, if birthmonth=3, birthday=22, birthyear=2000, it should return the String "3/22/2000"Create a public method called verifySSN that takes in a String parameter and returns a boolean. It will check the parameter against the person's SSN and return true or false based on whether they match.arrow_forwardCreate 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…arrow_forward
- - Simple factory is not considered a design pattern because it does not decouple the client from concrete classes Select one: True False 2- structural patterns provide guidance on the way in which classes interact to distribute responsibility Select one: True False 3- The Simple factory is used when you want to limit the instantiation of classes to one implementation Select one: True False 4- When a class A is composing a reference to another class B, then we say that class A has-a class B relationship Select one: True Falsearrow_forwardWhat is the difference between equals() and == ? == looks to see if they are identical objects whereas equals() matches the content of the objects. equals() looks to see if they are identical objects whereas == matches the content of the objects. equals() and | == are used to match the content of objects, so no difference. equals() is used to match string objects whereas == is used to match all objects. O O O Oarrow_forwardCreate a class Animal and Add a protected data member named id of integer type. Add get/set methods for id data member in Animal class with public access. Also provide default constructor this should initialize id to 0. Also provide parameterized constructor and toString method. Add an abstract method tellAboutSelf method to Animal class with public access Add another abstract method speak method to Animal class. Reptile, Bird, Mammal Next create the three child classes which extends form Animal class. Add a default constructor to each of the above created class. The constructor should initialize the id data member id, Reptile, Bird and Mammal, to 1, 2 and 3 respectively also it display a message “(class Name)’s default constructor”. E.g. for Bird it says “Bird’s default constructor”. Add a parameterized constructor to each of the above created class. The constructor should initialize the id data member, Reptile, Bird and Mammal, to the specified id passed to the constructor also it…arrow_forward
- Y:09 د واجب.pdf Base class A Base class B Private : Private : int B_value; int B_value; Protected: Protected: Public: void A_input() void A get() Public: void B_input() void B_get() Driver Class C: public A, public B C is a derived class from classes A and B Private: int D_value; Protected: Public: void difference() void A_get() void B_ get () void A input O void B get () // Enter the integer value of class A // Return value of int B_value void A get () void difference() // Return value of int A_value I/Calculate the difference between the two value (D = A_value - B_value) void B input ) // Enter the integer value of class B IIIarrow_forwarddayType Class We will be working on a project that designs a class calendarType, so that a client program can use this class to print a calendar for any month starting Jan 1. 1900. An example of the calendar for September 2019 is: September 2019 Sun Mon Tue Wed Thu Fri Sat 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 We will develop several classes which will work together to create a calendar. The first of these classes is called dayType which will manipulate a day of the week. The class dayType will store a day, such as Sun for Sunday. The class should be able to perform the following operations on an object of type dayType: a. Set the day. b. Print the day. c. Return the day. d. Return the next day. e.…arrow_forwardPython Programming 3. Write an Employee class that keeps data attributes for the following pieces of information:(a). Employee name(b). Employee numberNext, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information:(c). Shift number (an integer,such as1 for morning shift, 2 for evening shift)(d). Hourly payrateWrite the appropriate accessor and mutator methods for each class.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
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