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()
Want to see the full answer?
Check out a sample textbook solutionChapter 14 Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Introduction To Programming Using Visual Basic (11th Edition)
Starting Out With Visual Basic (8th Edition)
Mechanics of Materials (10th Edition)
Starting Out with Python (4th Edition)
- 4 Object Oriented Programming Assignment - 11 Write a Java program for the following Class Diagram. Document authors: String date: Date getAuthors: String addAuthoriname):void getDate()date Book -titleString getitiet): String EMail Subject: String -to: Stringl) getSubject) String getToString Instructions: 1. This java program is for an application that stores the author (Writer) data of some books and emails 2. getAuthors() method get the list of authors and store it in a String array. 3. addAuthors() method is used to add an author anytime for book or email. 4. getDate() method get the date of the book or email 5. getTitle() method can be used to get the title of the book 6. getSubject() method is used to get the Subject of the email. 7. getTo() method is used to get the information about the mail to whom it is sent. 8. All get methods need to return the values in the corresponding instance variables. 9. Scanner class can be used to set the data for the variables. The programmer can…arrow_forwardJavaarrow_forwardTrue or False Structure objects can be passed into a method only by reference.arrow_forward
- 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; //…arrow_forwardC++arrow_forwardC# problem when printing Weigh no value shows up code public class HealthProfile{private String _FirstName;private String _LastName;private int _BirthYear;private double _Height;private double _Weigth;private int _CurrentYear;public HealthProfile(string firstName, string lastName, int birthYear, double height, double weigth, int currentYear){_FirstName = firstName;_LastName = lastName;_BirthYear = birthYear;_Height = height;_Weigth = weight;_CurrentYear = currentYear;}public string firstName { get; set; }public string lastName { get; set; }public int birthYear { get; set; }public int height { get; set; }public double weight { get; set; }public int currentYear { get; set; }public int Person_Age{get { return _CurrentYear - _BirthYear; }}public double Height{get { return _Height; }}public double Weight{get { return Weight; }}public int Max_Heart_Rate{get { return 220 - Person_Age; }}public double Min_Target_Heart_Rate{get { return Max_Heart_Rate * 0.65; }}public double…arrow_forward
- True or False A static variable is shared among all instances of a class.arrow_forwardC++ Language Activity 5: DERIVED CLASS • Create a SAVING ACCOUNT class that inherits the class BANK ACCOUNT. • Create a constructor for the derived class that accepts INTEREST RATE. • Create a method that displays the INTEREST RATE. • Create a method that computes the INTEREST (BALANCE * INTEREST RATE) and adds to the current BALANCE.arrow_forwardC++ Programming Assignment 6 Dynamic Pets The objective of this lab is to demonstrate dynamic allocation and deallocation of memory. Instructions: Write a class called Pet that contains an animal’s name, type, and weight. Include a default constructor and destructor for the class. The constructor should print out the following message: “Creating a new pet”. The destructor should print out the following message: “In the Pet destructor.” Include appropriate get/set functions for the class. In main(), prompt the user to enter the number of pets in his or her household. Dynamically create a built-in array based on this number (not a vector or object of the array class) to hold pointers to Pet objects. Construct a loop in main() that executes once for each of the number of pets that the user indicated. Within this loop, ask the user to enter the name and type of pet. Using a random number generator, generate a weight between 1-100 pounds. Seed this random number generator with 100.…arrow_forward
- c++ Design a PayRoll class that has data members for an employee’s hourly pay rate,number of hours worked, and total pay for the week. Write a program with anarray of seven PayRoll objects. The program should ask the user for the number ofhours each employee has worked and will then display the amount of gross payeach has earned.Input Validation: Do not accept values greater than 60 for the number of hoursworked.arrow_forwardJava Assignment Outcomes: Student will demonstrate the ability to utilize inheritance in a Java program. Student will demonstrate the ability to apply the IS A and HAS A relationships. Program Specifications: Start by watching Video Segment 16 from Dr. Colin Archibald's video series (found in the module overview). Key in the program shown in the video and make sure it works. Then, add the following: Animals have a Weight. Animals have a Height. Dog is an Animal. Dogs have a Name. Dogs have a Breed. Dogs have a DOB. Cat is an Animal Cats have a Name. Cats have 9 lives, so you need to keep track of the remaining lives once a cat dies. Bird is an Animal Birds have a wing span Birds have a canFly which is true or false (some birds cannot fly) Create a test class that creates one of each type of animal and displays the animal’s toString method. Submission Requirements: You must follow the rules from the prior assignments. UMLs and Design Tools are not required for this one. YOU MAY…arrow_forwardc++ programmingarrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT