In the following code, will the two invocations of writeOutput produce the same output on the screen or not?
(The relevant classes are defined in Listings 8.1, 8.2, and 8.4.)
Person person - new Student(“Sam“, 999);
person.writeOutput();
person - new Undergraduate (“Sam”, 999, 1);
person.writetOutput ();
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Additional Engineering Textbook Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Starting Out with C++: Early Objects
Starting Out with C++ from Control Structures to Objects (9th Edition)
Starting out with Visual C# (4th Edition)
- Do the following program in Java Eclipse. Java Class that can be used to create a Fruit object as described below: A fruit has - a: - Date of Harvest -Color -Weight -Number of seeds a. Add all instance variables. b. The class must have getters and setters for all instance variables. c. The class must have two constructors, a no-args and a constructor that receives input for each instance variables. d. The parent class is abstract. e. its 1 abstract method and has toString() method f. its 2 children (concrete) also have toString() methods.arrow_forward•Person Class: Person class has attributes: String name, address and int age. Write setperson() function to set values and getPerson() to Print attributes. Also write appropriate constructors. •Employee Class: Write another class Employee having attributes department and salary of type string and double. Write methods setEmployee(), getEmployee() and appropriate constructors for Employee class. •Student Class: •Write a class Student having attributes registration number and GPA of type string and float. Also write setStudent(), getStudent() methods and required constructors. Use the concept of inheritance to achieve the above functionality. Write a main() function to display the information of employee and student. • Note: Call the constructors/methods of parent class in child class where requiredarrow_forward**Python code** Write a class definition line and a one line docstring for the class Dog. Write an __init__ method for the class Dog that gives each dog its own name and breed. Test this on a successful creation of a Dog object.>>> import dog>>> sugar = dog.Dog('Sugar', 'border collie')>>> sugar.name'Sugar'>>> sugar.breed'border collie'arrow_forward
- Write in python. Write a class named Employee that has **private** data members for an employee's name, ID_number, salary, and email_address. It should have an init method that takes four values and uses them to initialize the data members. It should have get methods named get_name, get_ID_number, get_salary, and get_email_address.Write a separate function (not part of the Employee class) named **make_employee_dict** that takes as parameters a list of names, a list of ID numbers, a list of salaries and a list of email addresses (which are all the same length). The function should take the first value of each list and use them to create an Employee object. It should do the same with the second value of each list, etc. to the end of the lists. As it creates these objects, it should add them to a dictionary, where the key is the ID number and the value for that key is the whole Employee object. The function should return the resulting dictionary.For example, it could be used like…arrow_forwardJava- Suppose that Vehicle is a class and Car is a new class that extends Vehicle. Write a description of which kind of assignments are permitted between Car and Vehicle variables.arrow_forwardexactly as mentioned:arrow_forward
- g) Make a class Class (as in a class of students, not a class as in a class of objects) that stores several Student objects. Store a list of students in an attribute called students. The initializer method should initialize the class as an empty class (no students). Implement a method add_student() that takes an object of class Student and adds it to class. Implement method pass_rate() that determines the fraction of students that pass the class (have a grade of >= 6). python code!!arrow_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_forwardCPSC 131: Introduction to Computer Programming IIProgram 3: Inheritance and Interface1 Description of the ProgramIn this assignment, you will make two classes, Student and Instructor, that inherit from asuperclass Person. The implementation of class Person is given. You will also need to writea test program to test the methods you write for these two classes. The implementationdetails are described as follows.Stage 1: In the first file Student.java, you should include the following additional instancevariables and methods (other than all instance variables and methods inherited from classPerson):• Private instance variables studentID, and major;• A constructor takes four inputs (name, age, studentID and major);• Two additional getter methods to return each of instance variables (accessor);• Two setter methods to change each of instance variables (mutator);• A method toString that converts a student’s information into string form. Thestring should have the format as shown in Figure 1.…arrow_forward
- quick answer pleasearrow_forwardProblem:Write a program to simulate the work of processes scheduler by using RR algorithm. Theprogram should have three classes which are:1. Process Class: This class represents the process where it has process id, executetime and completion time. Arrival is assumed to be zero all times. Process id shouldbe unique and the class create it for each process. Provide the required methodsaccordingly.2. RRSchedule Class: This class represents the work of the scheduler. It has mainlytwo lists of processes, quantum size, and clock. One of the list will be as a recordof the processes while the other is to work on to execute the process in CPU. Theclock should be a simple counter to represent timing to run the list of processes.The method list should be as following:a. Pop method: to remove the process from the top of the list.b. Push method: to insert the processes at the end of list after it is interruptedand still has to go to CPU again.c. RunRR method: to represent the job of RR scheduler.…arrow_forward(iv) Write a public instance method addProgrammeItem() that takes a Music argument representing a musical work and returns no value. As long as the running time of the concert will not exceed MAX_LENGTH by adding the item to the programme, the Music object is added to the programme. If it would make the running time too long, the message "Running time exceeded" is printed insteaarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education