If myClass has a constructor with a parameter of type String, select the other constructor that be included. O public myClass() {...} O public myClass(int value) {..) O public void myClass() {...} O public myClass(String str1, String str2) {...}
Q: You are part of a team writing classes for the different game objects in a video game. You need to…
A: public class Human { //is base class //declaring instance variables private String name;…
Q: class Animal { public String toString() { return "Animal"; } public String f() { return "Animal f";…
A: The solution is provided in the next step.
Q: elow is a basic class for court house employees. public class CourtEmpls { private String fname; //…
A: Solution: Given,
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: The following class sabo is included. Declaration section…
A: Statement "sabo p (2,4), q(3,2);" will create two objects of class sabo. Object 1: Name: p Values:…
Q: 1 Description of the Program In this assignment, you will make two classes, FullTime Employee and…
A: As per the given question, given the Employee class, we need to implement FullTimeEmployee,…
Q: The Article class has a default constructor with no parameters. Define a public overloaded…
A: The objective of the question is to define an overloaded constructor for the Article class that…
Q: a) How many members do class theClass have? b) Compare the purpose of the two constructors. c) Use…
A: A class is a blueprint for an object. A class can have instance variables and methods which are…
Q: JAVA Language Caesar Shift Question: Modify the Caesar class so that it will allow various…
A: Algorithm: Caesar Cipher1. Create an abstract class called Cipher. a. Define an abstract method…
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: public class Number { private int num; public Number(int n) { num = n; } /*…
A: 1. Import the Scanner class for user input.2. Define a `LabProgram` class.3. Inside the `LabProgram`…
Q: /* TestCarSensor.java - program to test the CarSensor class. */ public class TestCarSensor { public…
A: Errors in CarSensor.java: The class had below errors: Data type was missing for data member: error,…
Q: public class Team { private String name; private int wins, int losses; public…
A: Program Approach: In the given code a class "Team" is declared that defines one string "name"…
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: public class Car { public void m1( { Sustem.Qut.printla("car 1"); } public void m2() { super.m1(); }…
A: answer is
Q: public class FoodItem { private String name; private double fat; private double carbs;…
A: 1public class FoodItem { 2 private String name; 3 private double fat; 4 private double carbs;…
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: public class Point { Create two variables: 1. Generic Variable: Variable Name: data 2. Generic…
A: Please find the java code attached.
Q: class Clock { public: Clock() : hourValue_(0), minuteValue_(0), secondValue_(0) {};…
A: The objective of the question is to override the ShowTime() function of the base class 'Clock'…
Q: This lab will demonstrate how the toString() and equals() methods work when they a not overridden.…
A: for tostring()
Q: Please draw the UML for this code package lap; import java.util.Date; class Covenant { private…
A: The UML code is given in the below step
Q: Task 2: Write a class ReadMethod that extends the Method class. +: public -: private #: protected…
A: abstract class Method { // declaration of variables protected int input; protected String…
Q: Which type of relationship is depicted between Student and School? public class Student { private…
A: According to the information given:- We have to choose the correct option to satisfy the statement.
Q: Write a constructor for the IceCreamCup class. The constructor takes the name, and a List of Flavor…
A: Constructor for IceCreamCup class.
Q: Bread Class breadType: String - caloriesPerslice: integer + Bread(String breadType, integer…
A: - refers to private members + refers to public members
Q: class Time { private int hour; private int minute; private int second;…
A: The JAVA code is given below with output screenshot
Q: //PLEASE CORRECT MY MISTAKES, THANK YOU public class Person { private String personID; private…
A: As per the question, solution is mentioned below:
Q: class Airplane – highlights -- planeID : String -planeModel: String //”Boeing 757” etc.…
A: class AirPlane{private id String ;private int model;private int capacity;private String pilot;…
Q: Take the following code: class Song private: string name; string author; string genre; int…
A: Given code is: //setters are used change the value stored in one of an object's member variables…
Q: 5 Select one or more options from the list cat.getAge(); O cat.getName(); cat.getColor();…
A: Explanation: I have created a main class to for compiling this program, The methods that are in…
Q: 2. The MyInteger Class roblem Description: Design a class named MyInteger. The class contains: ● A…
A: The answer is given below.
Q: public class ItemToPurchase { private String itemName; private int itemPrice; private…
A: There was issue in taking the input and printing the details.
Q: ven the following class definition: class employee { public: employee(); employee(string,…
A: The code has given below
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: Given main(), define the Artist class (in file Artist.java) with constructors to initialize an…
A: 1// Artist.java 2public class Artist { 3 private String name; 4 private int birthYear; 5…
Q: 1. An abstract class called Pet is defined below: public abstract class Pet { private String id;…
A: Dear Student, As no programming language is mentioned I am assuming it to be Java. The Cat class…
Q: Assume the Book class is defined as follows: public class Book{ enum Type type…
A: The Book class is defined as follows: public class Book{ enum Type type {FICTION,NON_FICTION};…
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: class Artist{StringsArtist(const std::string& name="",int…
A: The objective of the question is to implement a function in C++ that combines two Singer objects…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- public class LabProgram { public static void main(String args[]) { Course course = new Course(); String first; // first name String last; // last name double gpa; // grade point average first = "Henry"; last = "Cabot"; gpa = 3.5; course.addStudent(new Student(first, last, gpa)); // Add 1st student first = "Brenda"; last = "Stern"; gpa = 2.0; course.addStudent(new Student(first, last, gpa)); // Add 2nd student first = "Jane"; last = "Flynn"; gpa = 3.9; course.addStudent(new Student(first, last, gpa)); // Add 3rd student first = "Lynda"; last = "Robison"; gpa = 3.2; course.addStudent(new Student(first, last, gpa)); // Add 4th student course.printRoster(); } } // Class representing a student public class Student { private String first; // first name private String last; // last name private double gpa; // grade point average…Question 13 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 main(String args[]) { Vehicle myVehicle= = new Plane(); myVehicle.drive(); } Driving vehicle syntax error Flying plane Driving vehicle Flying plane }Create a fee invoice application for students attending Valence College, a college in the State of Florida. There are two types of students: graduate and undergraduate. Out-of-state undergraduate students pay twice the tuition of Florida-resident undergraduate students (all students pay the same health and id fees). A graduate student is either a PhD or a MS student. PhD students don't take any courses, but each has an advisor and a research subject. Each Ms and Phd student must be a teaching assistant for one undergraduate course. MS students can only take graduate courses. A course with a Course Number (crn) less than 5000 is considered an undergraduate course, and courses with a 5000 crn or higher are graduate courses. CRN Course Credit Hours. 4587 MAT 236 4 4599 COP 220 3 8997 GOL 124 1 9696 COP 100 3 4580 MAT 136 1 2599 COP 260 3 1997 CAP 424 1 5696 KOL 110 2 7587 MAT 936 5 2599 COP 111 3 6997 GOL 109 1 2696 COP 101 3 5580 MAT 636 2 2099 COP 268 3 4997 CAP 427 1 3696 KOL 910 2…
- Consider the following code: class Player { private: string ID; string name; public: Player(string n, string s) { name = n; setID(s); } string getName() const { return name; } string getID() const { return ID; } void setID(string s) { ID = s; } }; class BasketballPlayer : public Player { private: int fieldgoals; int attempts; public: BasketballPlayer(string n, string i, int fg, int a) : Player(n, i) { fieldgoals = fg; attempts = a; } // line 1 void printStats() const { cout << " Pct: " << (double) fieldgoals / attempts << endl; } }; int main() { Player golfer("Tiger Woods", "123456789"); BasketballPlayer pointGuard("Stephen Curry", "567890123", 2585, 5523); } Describe the code : Player(n, i) at the end of the BasketballPlayer constructor. a. calls the Player constructor with parameters n, i c. derives Player from BasketballPlayer d. derives BasketballPlayer from Player e. calls the Player…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 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…
- 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,…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 */ } };this java class has a documentation comments describing the content to be added to it. Class Finder has 3 items TODO , write the code to add them to it /** * This class provides functions to search in arrays */ public class Finder { /** * Finder id */ private String id; /** * TODO: 1 * Constructor of the Finder type * * @param id String the id of the Finder */ public Finder(String id) { } /** * TODO: 2 * Getter method that returns the id of the Finder. * * @return String the id of the Finder */ public String getId() { } /** * TODO: 3 * Finds if an element is in an integer array. * * @param input Integer[] the array to search in * @param target Integer the value to search for * * @return int the index of the element if found, else -1 */ public int findElement(Integer[] input, Integer target) { } }
- 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…this is my retail item code: //Import statements public class RetailItem { private String description; private int units; private double price; public RetailItem() { } public RetailItem(String x, int y, double z) { description = x; units = y; price = z; } public RetailItem(RetailItem i) { } public void setDescription(String x) { description = x; } public void setPrice(double z) { price = z; } void setUnits(int y) { units = y; } public int getUnits() { return units; } public String getDescription() { return description; } public double getPrice() { return price; } // Main class public static void main(String[] args) { String str = "Shirt"; RetailItem r1 = new RetailItem("Jacket", 12,…