Starting Out with Programming Logic and Design (4th Edition)
Starting Out with Programming Logic and Design (4th Edition)
4th Edition
ISBN: 9780133985078
Author: Tony Gaddis
Publisher: PEARSON
bartleby

Videos

Textbook Question
Chapter 14.6, Problem 14.25CP

Look at the following pseudocode class definitions:

Class Vegetable

Public Module message ()

Display “I’m a vegetable.”

End Module

End Class

Class Potato Extends Vegetable

Public Module message ()

Display “I’m a potato.”

End Module

End Class

Given these class definitions, what will the following pseudocode display?

Declare Vegetable v

Declare Potato p

Set v = New Potato ()

Set p = New Potato()

Call v. message()

Call p. message()

Blurred answer
Students have asked these similar questions
Q.2.3 Explain what it means when a module is said to be functionally cohesive. Q.2.4 Convert the following pseudocode into a class diagram.                     class Weapon                         Declarations                                string make                                string model                                string serialNumber                                string countryOfOrigin                          void setMake (string manufacturer)                               set make = manufacturer                          return                          string getMake()                          return make                     endClass
Look at the following class definitions:class Vegetable{      public virtual void message()      {           MessageBox.Show("I'm a vegetable.");      }}class Potato : Vegetable{    public override void message()    {          MessageBox.Show("I'm a potato.");    }}Given these class declarations, what will the following code display?Vegetable v = new Potato();Potato p = new Potato();v.message();p.message();
Design an Essay class that extends the GradedActivity class presented in this chapter. The Essay class should determine the grade a student receives for an essay. The student’s essay score can be up to 100 and is determined in the following manner:Grammar: 30 pointsSpelling: 20 pointsCorrect length: 20 pointsContent: 30 pointsDemonstrate the class in a simple program.

Chapter 14 Solutions

Starting Out with Programming Logic and Design (4th Edition)

Ch. 14.2 - Prob. 14.11CPCh. 14.2 - What is a constructor? When does a constructor...Ch. 14.2 - What is a default constructor?Ch. 14.3 - Prob. 14.14CPCh. 14.3 - Suppose a class has a field named description. The...Ch. 14.3 - Prob. 14.16CPCh. 14.4 - Prob. 14.17CPCh. 14.4 - What technique was described in this section for...Ch. 14.4 - What are classes responsibilities?Ch. 14.4 - Prob. 14.20CPCh. 14.5 - In this section, we discussed superclasses and...Ch. 14.5 - Prob. 14.22CPCh. 14.5 - What does a subclass inherit from its superclass?Ch. 14.5 - Look at the following pseudocode; which is the...Ch. 14.6 - Look at the following pseudocode class...Ch. 14 - Prob. 1MCCh. 14 - Prob. 2MCCh. 14 - A(n) ____ is a member of a class that holds data....Ch. 14 - The _________ specifies how a classs field or...Ch. 14 - A classs fields are commonly declared with the...Ch. 14 - Prob. 6MCCh. 14 - In many programming languages, the _____ key word...Ch. 14 - A(n) ____ method gets a value from a class's field...Ch. 14 - A(n) ____ method stores a value in a field or...Ch. 14 - A(n) ____ method is automatically called when an...Ch. 14 - A set of standard diagrams for graphically...Ch. 14 - When the value of an item is dependent on other...Ch. 14 - A classs responsibilities are _____. a. objects...Ch. 14 - In an inheritance relationship, the _____ is the...Ch. 14 - In an inheritance relationship, the _____ is the...Ch. 14 - The ___________ characteristic of object-oriented...Ch. 14 - The practice of procedural programming is centered...Ch. 14 - Object reusability has been a factor in the...Ch. 14 - It is a common practice in object-oriented...Ch. 14 - One way to find the classes needed for an...Ch. 14 - The superclass inherits fields and methods from...Ch. 14 - Polymorphism allows a class variable of the...Ch. 14 - Prob. 1SACh. 14 - Prob. 2SACh. 14 - What is the difference between a class and an...Ch. 14 - In many programming languages, what does the New...Ch. 14 - The following pseudocode statement calls an...Ch. 14 - Prob. 6SACh. 14 - What does a subclass inherit from its superclass?Ch. 14 - Look at the following pseudocode, which is the...Ch. 14 - Prob. 1AWCh. 14 - Look at this partial class definition, and then...Ch. 14 - Look at the following description of a problem...Ch. 14 - In pseudocode, write the first line of the...Ch. 14 - Look at the following pseudocode class...Ch. 14 - Pet Class Design a class named Pet, which should...Ch. 14 - Car Class Design a class named Car that has the...Ch. 14 - Personal Information Class Design a class that...Ch. 14 - Emp1oyee and ProductionWorker Classes Design an...Ch. 14 - Essay Class Design an Essay class that extends the...

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Computer Science
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 A class always has a constructor that does not take any parameters even if there are other constructors in the class that take parameters. Choose one of the options:TrueFalse
    Java language pls write a main program of the language class given below and make sure that your output matches with the one given below. Language.java public final class Language {    //    // Static Data Fields    //       private static final String defaultAlienSound = "~ ąļīæń ~ "; // Default      //    // Instance Data Fields    //      //    // Constructors    //    public Language() {    }    public Language(String language) {          switch (language.toLowerCase()) {            case "alien" -> this.populateAlienPhrases();            // Supported            case "chinese" -> this.populateChinesePhrases();        // Future implementation            case "french" -> this.populateFrenchPhrases();          // Future implementation            case "spanish" -> this.populateSpanishPhrases();        // Future implementation            case "future" -> this.populateYourLanguagePhrases();    // Future implementation            default -> this.populateEnglishPhrases();…
    Programing language Java. Define a class that represents a smartphone and in particular its battery. The battery has a capacity in mAH (milliamp-hours). This would be a parameter to yourconstructor. Several features of the phone consume battery power: the screen, voicecalling, wifi, and Bluetooth. These can be on or off. When on, they use power asgiven in the following table:screen 500 mAvoice 300 mAwifi 200 mABluetooth 100 mAThe battery life (in hours) of the phone is its capacity (in mAH) divided by the totalpower use of all the features that are turned on (in mA). Your class should have amethod that computes and returns the battery life given the current settings of thefeatures. The purpose of this question is for you to get practice with objects havingboth state and behavior. Hint: you should use boolean instance variables to representthe states of each of the four features outlined above. Look up a phone’s battery capacity (for example, 2200 mAH) and write a short mainmethod which…
  • Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A,B,C,D,E" is correct. Each question has one correct answer. Thank you. Part 1 - 5. In Java, inheritance uses __ relationship. A. is-aB. part-ofC. has-aD. member-ofE. None of the options Part 2 - 6. Given the following code, the output is __. class Apple { int x = 15; }class Banana extends Apple { int x = 25; }public class Sample { public static void main(String[] args) {Apple a1 = new Banana();  System.out.println(a1.x); }} A. Compiler errorB. 25C. 15D. 0E. None of the options
    C++ Personal Information Class: Design a class that holds the following personal data: name, age, and phone number. Write appropriate accessor and mutator functions. Demonstrate the class by writing a program that creates three instances of it. One instance should hold your information, and the other two should hold your friend's or family member's information.
    write c++ code for Design a class named Computer that holds the make, model, and amount of memory of a computer. Include methods to set the values for each data field, and include a method that displays all the values for each field. Create the class diagram and write the pseudocode that defines the class.   // Pseudocode PLD Chapter 10 #4 pg. 461// Start// Declarations// Computer myComputer// string make// string model// int memory// output "Please enter the Make: "// input make// output "Please enter the Model: "// input model// output "Please enter the Amount of Memory: "// input memory// Set the Make for myComputer// Set the Model for myComputer// Set the Amount of Memory for myComputer// output "Make: ", myComputer.getMake()// output "Model: ", myComputer.getModel()// output "Amount of Memory: ", myComputer.getMemory()// Stop   header #include <string>using namespace std;#ifndef _Computer#define _Computerclass Computer{private:string make; // computer makestring model; //…
  • Look at the following class declarations: class Plant { public virtual void Message() { MessageBox.Show("I'm a plant."); } } class Tree : Plant { public override void Message() { MessageBox.Show("I'm a tree."); } } Given these class definitions, what will the following code display? Plant p = new Tree(); p.Message();
    on JAVA language      Define a class named Wall. The class should have two private double variables, one to store the length of the Wall and another to store the height ._Create adefault constructor that sets the length& height to 0, create a second constructor with input parameters for the of the data variables and third copy constructor.Add accessor and mutator functions to read and set both variables Add another function that returns the area of the Wall as double .Write program that tests all your constructors and functions for at least three different Wall objects
    Language: C++Define a base class shape that includes protected data members for area and volume of a shape, public methods for computing area and volume of a shape, and a display function to display the information about an object. Derive a class point from the shape class. This point class contains two protected data members that hold the position of point. Provide no argument and 2-argument constructors. Override the appropriate functions of base class. Derive a class Circle publicly from the point class. This class has a protected data member ofradius. Provide a no-argument constructor to initialize the fields to some fixed values. Provide a 3-argument constructor to initialize the data members of Circle class to the values sent from outside. Override the methods of base class as required. Derive another class Cylinder from the Circle class. Provide a protected data member for height of cylinder. Provide a no-argument constructor for initializing the data members to default values.…
    • SEE MORE QUESTIONS
    Recommended textbooks for you
  • Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
  • C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education
  • Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education
    C++ Data Members; Author: CppNuts;https://www.youtube.com/watch?v=StlsYRNnWaE;License: Standard YouTube License, CC-BY