What is outpout? public class Vehicle { public void drive(){ System.out.println("Driving vehicle"); } } public class Plane extends Vehicle { @Override public void drive(){ System.out.println("Flying plane"); } public static void mainString aras[1) {
Q: class Node { int key; Node l, r; public Node(int item) { key = item;…
A: I have modified your code and little bit and now it's working fine, kindly check it out. Code…
Q: class Time { private: int hour; int minute; int second; public: Time(): Time(0, 0, 0) { Time(int s):…
A: 1. Include necessary header files (e.g., <iostream>).2. Define a class called Time.3. In the…
Q: package myq2; class Sale { int sellerID, milksale, buttersale; Sale(int sid, int ms, int bs) {…
A: The problem is based on the basics of classes in java programming language.
Q: class Animal { public String toString() { return "Animal"; } public String f() { return "Animal f";…
A: The solution is provided in the next step.
Q: 1. Add a field to the Hexagon.java class called side. It should be a double. 2. Write a no arguments…
A: Constructor is called when a instance of the class is created. It is used to initialize the object.…
Q: package pkl public class Parent{ private String name; int id; public double fees private void…
A: We need to check the above code. And write the explanation of which option are correct so we will…
Q: public class Base { public void PrintName() { System.out.println("Base"); static void PrintClass() {…
A: The full code for the first problem is :public class Base { public void PrintName() {…
Q: Code: interface Bicycle{ //interface for bicycle void changeGear(int val); //abstract…
A: Solution is given below-
Q: itialBalance; } public Account () { balance = 0; } public void deposit (double amount){ balance +=…
A: the code is an given below :
Q: 1. class rectangle { 2 private: 3. double width; double length; 5. public: rectangle(double w=0.0,…
A:
Q: public class Shape { Color fillColor; } public Shape() } fill Color = Color. RED; } public…
A: Lets talk about shape class(which is base class of Circle class): -->having attribute/data…
Q: The base class Pet has protected fields petName, and petAge. The derived class Cat extends the Pet…
A: The main() method of a program that makes instances of the Pet and Cat classes and prints their…
Q: 58. How many finalizers can a class have? - a. C. 2 d. Any number b. 1 59. Which of the following…
A: Note: This is a multiple-question-based problem. As per company guidelines, only the first question…
Q: e int a; e static int y = 10; numClass(int newX) X; } void set(int newX) X; y+=a; } public static…
A: Explanation: Here, first the value of y of one object is set to 30. Then, on object two the set…
Q: public class Stadium extends baseStadium{ public int typeTicket; int floors; int seating;…
A: The code includes three classes: Stadium, ticket, and baseStadium, and one interface TicketService.…
Q: PlayerRoster.java:139: error: class, interface, or enum expected import java.util.Scanner;…
A: We need to rectify the errors in the given Java code.
Q: private: int x, у;
A: Corrected Program: #include<iostream.h> #include<conio.h> class Point { private: int…
Q: class Time { private int hour; private int minute; private int second;…
A: The JAVA code is given below with output screenshot
Q: class Vehicle { protected String brand = "Ford"; public void honk() { System.out.println("Tuut,…
A: The inheritance can be denoted as an important part of the object oriented programming concept. It…
Q: Computer Science c++ help comment code please. Complex has multiple parameters to overload i think.…
A: The given class Complex has 2 private attributes real and complex The class has default constructor,…
Q: class Player { protected: string name; double weight; double height; public:…
A: Note: since your question contain multiple subparts but we can answer only 3sub-parts at a time…
Q: Identify errors if there is any & after identifying rewrite the code: public class Employce {…
A: Error Free Textual Code :- //The type Employee must be an abstract class to define a abstract…
Q: Question 1 public class Flat { private int noofRooms; private double area; private boolean seaView;…
A: public class Flat { private int noOfRooms; private double area; private boolean seaView;…
Q: Conver the class To UML diagram class Clint { private String accNumber; private…
A: The given problem is related to UML designing where the Java code is given having 2 classes and the…
Q: This is a simple lab that will demonstrate the order of when constructors are called. There are 3…
A: Code in java: class ParantClass { public ParantClass() { System.out.println("I am…
Q: public class Person { private String personID; private String firstName; private String lastName;…
A: Your code is also correct but I have provided more efficient code below.
Q: 3.1- Which statement(s) are true? Choose all that apply. a. This code prints "123" to the output. b.…
A: Firstly, when access specifier is not mentioned, in java it will consider as some default specifier…
Q: List the differences between CommissionEmployee class and BasePlusCommissionEmployee class public…
A: #include 4 using std::cout; 5 6 #include "CommissionEmployee.h" // CommissionEmployee class…
Q: Given a base Plant class and a derived Flower class, complete main() to create an ArrayList called…
A: Algorithm:Create an empty ArrayList called myGarden to hold Plant or Flower objects.Initialize an…
Q: Public classTestMain { public static void main(String [ ] args) { Car myCar1,…
A: Solution: Given,
Q: Check the code above and answer the following: 1.name="M"; is accessible
A: We need to check the above code.See below steps.
Q: Java language pls write a main program of the language class given below and make sure that your…
A: I Have implemented both the classes and also attached execution screenshot.Exception handling part…
Q: UML for the following Code: public class ProductOrder { private int numBook = 0; private…
A: Answer: We have written UML diagram for given following code
Q: public class Course { private String courseNumber, courseTitle; public Course() {…
A: SOLUTION - So, in this code, you are getting a Space error. This is because of these two lines -…
Q: Given main() and a base Book class, define a derived class called Encyclopedia with member methods…
A: As per the given information, I need to provide the code for Encyclopedia class.Algorithm for…
Q: What is outpout?
A: In step 2, I have provided answer , then I have provided JAVA CODE along with CODE SCREENSHOT…
Q: Stairviewer public static void main(String (] args) // Step 2: Create a rectangle and draw it as the…
A: ANSWER: Draw Rectangle in C graphics: Draw rectangle for utilized Rectangle(). Directions of left…
Q: Show StudentsADT interface
A: package xyz;public class Course { private String courseName;private String sectionNumber;private…
Q: What is the output of the following code? Convert the abstract class into an interface and modify…
A: To do: Output of the given code
Q: a. In the above code, is the member function out() accessible by obj1? b. Name the member…
A: Step 1:- Given:- #include <iostream>using namespace std;class PPP{ int H; protected:…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- class smart { public: void print() const; void set(int, int); int sum(); smart(); smart(int, int); private: int x; int y; int secret(); }; class superSmart: public smart { public: void print() const; void set(int, int, int); int manipulate(); superSmart(); superSmart(int, int, int); private: int z; }; Now answer the following questions: a. Which private members, if any, of smart are public members of superSmart? b. Which members, functions, and/or data of the class smart are directly accessible in class superSmart?class implementation file -- Rectangle.cpp class Rectangle { #include #include "Rectangle.h" using namespace std; private: double width; double length; public: void setWidth (double); void setLength (double) ; double getWidth() const; double getLength() const; double getArea () const; } ; // set the width of the rectangle void Rectangle::setWidth (double w) { width = w; } // set the length of the rectangle void Rectangle::setLength (double l) { length l; //get the width of the rectangle double Rectangle::getWidth() const { return width; // more member functions herepublic class Car { private int modelYear; // TODO: Declare purchasePrice field (int) private int currentValue; public void setModelYear(int userYear){ modelYear = userYear; } public int getModelYear() { return modelYear; } // TODO: Define setPurchasePrice() method // TODO: Define getPurchasePrice() method public void calcCurrentValue(int currentYear) { double depreciationRate = 0.15; int carAge = currentYear - modelYear; // Car depreciation formula currentValue = (int) Math.round(purchasePrice * Math.pow((1 - depreciationRate), carAge)); } // TODO: Define printInfo() method to output modelYear, purchasePrice, and currentValue } import java.util.Scanner;import java.lang.Math; public class CarValue { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Car myCar = new Car(); int userYear = scnr.nextInt(); int userPrice = scnr.nextInt(); int…
- public class Author2 {3 private String name;4 private int numberOfAwards;5 private boolean guildMember;6 private String[] bestsellers;78 public String Author()9 {10 name = "Grace Random";11 numberOfAwards = 0;12 guildMember = false;13 bestsellers = {"Minority Report", "Ubik", "The Man in the HighCastle"};14 }1516 public void setName(String n)17 {18 name = n;19 }20 public String getName()21 {22 return name;23 }2425 public void winsAPulitzer()26 {27 System.out.println(name + " gave a wonderful speech!");28 }29 } 1. This class includes a constructor that begins on line 8; however, it contains an error. Describe the error. 2. Rewrite the constructor header on line 8 with the error identied in part c of this question corrected. 3. Demonstrate how you might overload the constructor for this class. Write only the header. 4. Write a line of Java code to create an instance (object) of this class. Name it someAuthor. 5. Write a line of code to demonstrate how you would use the someAuthor object…Java script. class Chameleon { static colorChange(newColor) { this.newColor = newColor; return this.newColor; } constructor({ newColor = 'green' } = {}) { this.newColor = newColor; } } const freddie = new Chameleon({ newColor: 'purple' }); console.log(freddie.colorChange('orange'));.public class Cat extends Pet { private String breed; public void setBreed(String userBreed) { breed = userBreed; } public String getBreed() { return breed; }} public class Pet { protected String name; protected int age; public void setName(String userName) { name = userName; } public String getName() { return name; } public void setAge(int userAge) { age = userAge; } public int getAge() { return age; } public void printInfo() { System.out.println("Pet Information: "); System.out.println(" Name: " + name); System.out.println(" Age: " + age); } } import java.util.Scanner; public class PetInformation { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); // create a generic Pet and a Cat Pet myPet = new Pet(); Cat myCat = new Cat(); // declare variables for pet and cat info String petName, catName, catBreed; int petAge,…
- Computer Science hand.javapackage poker; import com.google.gson.Gson;import com.google.gson.GsonBuilder;import poker.Card; public class Hand{//private transient int i=10;// marked transient they will not serialized / deserialized public Card[] cards; public Hand(){} public boolean is_better_than(Hand H){return false;} public boolean is_equal(Hand H){return false;}} card.javapackage poker; public class Card{public enum Suite{HEARTS,CLUBS,DIAMONDS,SPADES} public enum Value{ACE,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE,TEN,JACK,QUEEN,KING} public Suite suite;public Value value; public Card(){ }} // main.java import com.google.gson.Gson;import com.google.gson.GsonBuilder;import poker.Hand;import poker.Card; public class Main{ public static void main(String[] args){// this function is provided as a convenient way to// run the code from the command line.//// it will not be graded, but it needs to compile and// execute without a failure. System.out.println("Start"); // Demonstrate…class Course { private String courseNumber; private String courseName; private int creditHrs; public Course (String number, String name, int creditHrs){ this.courseNumber = number; this.courseName = name; this.creditHrs = creditHrs; } public String getNumber() { return courseNumber; } public String getName() { return courseName; } public int getCreditHrs() { return creditHrs; } public void setCourseNumber(String courseNumber) { this.courseNumber = courseNumber; } public void setCourseName(String courseName) { this.courseName = courseName; } public void setCreditHrs(int creditHrs) { this.creditHrs = creditHrs; }}class Student { private String firstName; private String lastName; private String gender; private String phoneNumber; private String email; private String jNumber; protected ArrayList courseList; public String getFullName() {…class IndexItem { public: virtual int count() = 0; virtual void display()= 0; };class Book : public IndexItem { private: string title; string author; public: Book(string title, string author): title(title), author(author){} virtual int count(){ return 1; } virtual void display(){ /* YOU DO NOT NEED TO IMPLEMENT THIS FUNCTION */ } };class Category: public IndexItem { private: /* fill in the private member variables for the Category class below */ ? int count; public: Category(string name, string code): name(name), code(code){} /* Implement the count function below. Consider the use of the function as depicted in main() */ ? /* Implement the add function which fills the category with contents below. Consider the use of the function as depicted in main() */ ? virtualvoiddisplay(){ /* YOU DO NOT NEED TO IMPLEMENT THIS FUNCTION */ } };
- True or False A class can implement more than one interface.public class Person { private String personID; private String firstName; private String lastName; private String birthDate; private String address; public Person(){ personID = ""; firstName = ""; lastName = ""; birthDate = ""; address = ""; } public Person(String id, String first, String last, String birth, String add){ setPerson(id,first,last,birth,add); } public void setPerson(String id, String first, String last, String birth, String add){ personID = id; firstName = first; lastName = last; birthDate = birth; address = add; } public String getFirstName(){ return firstName; } public String getLastName(){ return lastName; } public String getBirthdate(){ return birthDate; } public String getAddress(){ return address; } public void print(){ System.out.print("\nPerson ID = " + personID); System.out.print("\nFirst Name = " +firstName); System.out.print("\nLast Name = " +lastName); System.out.print("\nBirth Date = " +birthDate); System.out.print("\nAddress = " +address); } public String…public class Cylinder { public void smoothen() { } } } public abstract class Vessel implements Steerable { private Engine e; } System.out.println("Smoothening.."); public Engine getEngine() { return e; } public void setEngine (Engine e) { this.e = e; } public abstract void turnOn(); public class Engine { private Cylinder [] y; private int cyls = 1; static final int maxCylinders = 12; public void addCylinder (Cylinder y) { if (cylsSEE MORE QUESTIONS