1. Write a class "Ball" which extends the class disk. It has deltax and deltay attributes. 2. Write the constructor of this class. 3. Write the mothods move(), reverse DeltaX(), reverseDeltaY() methods which multiplies the coordinates with -1. 4. Write the getters and the setters of the class.
Q: Add the following accessor methods to your Rectangle class:public boolean contains(int x, int…
A: How is the rectangle represented? Three points? Four points? Point, sides and angle? Two points and…
Q: In Java Write a class definition for a Rectangle class that contains: • Two int fields, length…
A: Here's the Java code for the Rectangle class: public class Rectangle { private int length;…
Q: Write a Hamster class that is a subclass of Pet. Include: an additional attributes called…
A: A class is a group of objects which have common properties. A constructor is a method that is used…
Q: IN JAVA Which is true? A. Private members can be accessed by a class user B. A mutator is also…
A: A. is CORRECT as Private members can be accessed by a class user B. is INCORRECT as mutator is also…
Q: Create a new class called Dog that is derived from the Pet class given in Listing 6.1 of Chapter 6.…
A: CODE TO COPY:-
Q: Fill in the CODE (Answer) or the bolded Answer word. A class BankAccount with the following data…
A: String name, String acctNum, and double balance are data members of the BankAccount type. It…
Q: Modify the method beginsWithVowel. Use a different way to implement the method (try method indexOf()…
A: Updated Driver class import java.util.*; public class PigLatin { public static void…
Q: In main.py define the Student class that has two attributes: name and gpa Implement the following…
A: 1) Below is python program that defines Student Class with attributes name and GPA. It also…
Q: B - RobotFriend Create a RobotFriend class. RobotFriend is a new toy just on the market. Copy the…
A: EXPLANATION: - The RobotFriend class Details: - Instance Variables Declaration private String…
Q: Define a class called Country. A Country has populationSize, area, capital, currency, and…
A: Since the coding language is not mentioned , I have done the code in java. Algorithm : Step 1 :…
Q: Write the source code of the class CrewMember. A crew member cannot change its duty type. For…
A: CrewMember is a class and it has CrewType Enum and recruited date We are also going to implement…
Q: Using the ABCMeta class as the abstract class's metaclass, implement an abstract class in Python.…
A: Your python program is given below as you required with an output.
Q: Using JAVA write a code to: Implement a class Person with a name and a year of birth. Add a class…
A: The algorithm can be summarized as follows: Define the Person class with instance variables name…
Q: Write a class to represent a AlternativeEnergyCar. Select the fields and methods that fit the…
A: Hello Student, hope you are doing well, I will be trying my best to explain and fulfill your query.…
Q: Time -hour:int -minute:int -second:int hour minute second [0, 23] [0, 59] [0, 59]…
A: public class TimeMain { public static void main(String[] args) { Time t1=new…
Q: Exercise (Section 30/40): Implement a superclass Appointment and subclasses Onetime, Daily, and…
A: Solution: Given, Implement a superclass Appointment and subclasses Onetime, Daily, and Monthly.…
Q: 9 Implement the following constructor. The class has two attributes: rank and suit. Make sure the…
A: NOTE: - The programming language is not mentioned, so below code is done in JAVA. The card class has…
Q: Create a class SubstitutionCipher that implements the interface MessageEncoder, as described in the…
A: According to the information given:- We have to follow the instruction in order to get desired…
Q: Design and implement a set of classes that define the employees of a hospital. Start by creating a…
A: Use of Java: Web applications are frequently created using Java, a well-known server-side…
Q: Implement a Person class with the following attributes: Name: String Place of Birth: String…
A: Dear Student, As no language is mentioned , I am assuming it to be python.
Q: Create an interface Wheel with methods setWheels (int c) and getWheels () and a class Vehicle with…
A: Create an interface Wheel with methods setWheels (int c) and getWheels () and a class Vehicle with…
Q: Below is code that defines a Quadrilateral class (a shape with four sides), which has four floating…
A: The solution is given in the next step
Q: 1. Write a class "Ball" which extends the class disk. It has deltax and deltay attributes. 2. Write…
A: I have provided the answer based on Java Programming. Detailed comments are included for a better…
Q: In this java assignment, we will be creating a paystub for an employee using classes, files,…
A: In the given problem, we need to define three classes (named Employee, PayPeriod, and…
Q: Write a destructor for the CarCounter class that outputs the following. End with newline.Destroying…
A: I give the code in C++ along with the output and code screenshots
Q: Implement the Critter class. Each critter C has attributes species, size, and age. • The constructor…
A: QUESTION:
Q: Exercise 2. a. Generate 3 Item objects using the all parameters constructor, let the user input all…
A: Note: As no programming language is mention. So I am using Java to answer this question.
Q: For the Employee class, create the following: A private String instance variable m name. A private…
A: Screenshots of the code: 1.
Q: 2. Declare and implement a class named MyQuote. This class will have a string data member quote…
A: The complete Java code is provided below along with code Image and Output.
Q: ctional). Your class should have a constructor that sets all the properties, and a toString method…
A: the code is an given below :
Q: A sample Student class. Fields are name and marks (float). A static field is passLimit (how many…
A: A class is a user-defined data type that encapsulates the instance and non-instanced or static…
Q: ATM • Location : string Card Scanner + Show() : void + AcceptCard) : bool • ReadCard() : void +…
A: While doing programming in any programming language, you need to use various variables to store…
Q: Write the source code of the class Passenger. A passenger can travel with an infant (i.e. his/her…
A: Programming instructions: Include necessary header files. Create a class Passenger. In the…
Q: 1) Implement the class Director: The newContract method tells us that the director has new film; its…
A: Use getInstance method in Calendar to get the current time and we have to print this time with…
Q: Implement the Seller class as a derived class of Person class. Create the seller.h and seller.cpp…
A: The c++ program is given below:
Q: Task 1: The first task is to make the maze. A class is created called Maze, in which a 2D array…
A: package maze; /** A class to represent cells in a maze. Cells can be blocked, * open, or visited.…
Q: Sally and Harry implement two different compareTo methods for a class they are working on together.…
A: Two distinct compareTo methods have been implemented by Sally and Harry for a class they are…
Q: Preliminaries • Write a Point class with two properties: 1, y. Write required constructor, get &…
A: EXPLANATION: - The Point class comprises two instance variables of type double. The parameterized…
Q: Need help on java homework assignment, It says Create a class Vehicle. A Vehicle has a single…
A: Create abstract class Vehicle :Initialise a private string vehicleTypeCreate a constructor for…
Q: Define a BankAccount class that has: accNum (int) Balance (double) ● a constructor four methods: O…
A: BankAccount Class:1. Define a class named BankAccount.2. Declare private instance variables: -…
Q: In this java assignment, we will be creating a pay stub for an employee using classes. Each class…
A: The above program makes use of Scanner class defined within java.util package that is used to take…
Step by step
Solved in 2 steps with 2 images
- Write a class named Vehicle with vehicleType, manufactureYear(int) and cost(double) as private data fields. [Hint: VehcleType could be "truck", "4WD", "Bus"] . Add a constructor with any two parameters of the superclass. Write a class named Car which inherits the Vehicle class. Add a non-static private string variable called companyName. Add a constructor in the subclass and a toString() method that prints the Car's data fields in the order VehicleType, manufactureYear, companyName [Hint: Add a toString( ) method in the superclass as well]. Create objects of Vehicle and Car class. Can the object of Vehicle class be stored in an object of Car Class? If yes, write the code. If No, Explain why? ***Student Instruction *** You need to write the complete code as mentioned below: i) The main class with necessary codes. ii) The subclass with necessary codes.iii) The Test class with necessary codes.Implement the inventory manager class. This class must have methods that do the following: Add a new item to the inventory manager. Remove an item from the inventory manager. Re-stock an item in the inventory manager. Display the items in the inventory manager. Search for an item in the inventory manager by at least two criteria (name, price, quantity, etc.). Part 3: Test the inventory manager class with a driver program or unit tests. This may be a console application.Complete the Course class by implementing the courseSize() method, which returns the total number of students in the course. Given classes: Class LabProgram contains the main method for testing the program. Class Course represents a course, which contains an ArrayList of Student objects as a course roster. (Type your code in here.) Class Student represents a classroom student, which has three fields: first name, last name, and GPA. Ex. For the following students: Henry Bendel 3.6 Johnny Min 2.9 the output is: Course size: 2 public class LabProgram { public static void main (String [] args) { Course course = new Course(); // Example students for testing course.addStudent(new Student("Henry", "Bendel", 3.6)); course.addStudent(new Student("Johnny", "Min", 2.9)); System.out.println("Course size: " + course.courseSize()); } } public class Student { private String first; // first name private String last; // last name private…
- The goal of this coding exercise is to create two classes BookstoreBook and LibraryBook. Both classes have these attributes: author: Stringtiltle: Stringisbn : String- The BookstoreBook has an additional data member to store the price of the book, and whether the book is on sale or not. If a bookstore book is on sale, we need to add the reduction percentage (like 20% off...etc). For a LibraryBook, we add the call number (that tells you where the book is in the library) as a string. The call number is automatically generated by the following procedure:The call number is a string with the format xx.yyy.c, where xx is the floor number that is randomly assigned (our library has 99 floors), yyy are the first three letters of the author’s name (we assume that all names are at least three letters long), and c is the last character of the isbn.- In each of the classes, add the setters, the getters, at least three constructors (of your choosing) and override the toString method (see samplerun…USING JAVA: Part A) Implement a superclass Appointment and subclasses Onetime, Daily, and Monthly. An Appointment has a description (for example, “See the dentist”) and a date. Write a method, occuresOn(int year, int month, int day) The check whether the appointment occurs on that date. For example, for appointment, you must check whether the day of the month matches. This fill an array of Appointment objects with a mixture of appointments. Have the user enter a date and print out all appointments that occur on that date. Part B) Improve the appointment book by giving the user the option to add new appointments. The user must specify the type of the appointment, the description, and the date.Create a class Animal Create a class Cat, and a class Dog, and a class Bearded Dragon which extend Animal. Add to your Animal class: Member: name Methods: Public Animal (String name) //constructor public void makes Sound () with the implementation printing out a generic animal sound. Next, override (add) the makes Sound() method to your Cat and Dog class, with the implementation specific to each animal (i.e, cat says purr..). Do not override the makesSound() for your Dragon (bearded dragons don't make sounds!) Note, you'll also need a constructor in each of your subclasses which calls super(name) to initialize the common 'name' member of Animal. Next (in your test harness) create a List of different Animals ( a couple cats, a dog, a dragon... ) and add these Animals to your list. Iterate through your list & call makeSound on each. (you should observe the makeSound method called will be: cat -> from Cat class, dog-> from Dog class, bearded Dragon -> from Animal class ) EC:…
- Number 11This is for python class, so please answer in python 9.12 LAB: Product class In main.py define the Product class that will manage product inventory. Product class has three attributes: a product code, the product's price, and the number count of product in inventory. Implement the following methods: A constructor with 3 parameters that sets all 3 attributes to the value in the 3 parameters set_code(self, code) - set the product code (i.e. SKU234) to parameter code get_code(self) - return the product code set_price(self, price) - set the price to parameter price get_price(self) - return the price set_count(self, count) - set the number of items in inventory to parameter count get_count(self) - return the count add_inventory(self, amt) - increase inventory by parameter amt sell_inventory(self, amt) - decrease inventory by parameter amtDefine a new "Exam" class that manages the exam name (string) and its score (integer). For example, an exam can have - "Midterm Exam", 100 - "Final Exam", 50 The class must not provide the default constructor. It must require the exam name and score in order to initialize the Exam object. The class must provide only the following methods (no more and no less): - isPerfect method that returns true if the score is exactly 100 and false otherwise. - isPassing method that returns true if the score is equal or greater than 70 and false otherwise. - toString method must return all the exam information including the result of the exam as a string in the following format: EXAM(<name>) SCORE(<score>) RESULT(Pass/Fail) such asEXAM(Midterm Exam) SCORE(100) RESULT(Pass) EXAM(Final Exam) SCORE(50) RESULT(Fail) "Pass" means the score is greater or equal 70. "Fail" is whenever the score is below 70. - isGreater method that compares with another Exam object and return true if the score…
- 1. Implement the above system using inheritance in the best possible way. Keep every object size as small as possible. Implement all methods (setter/getter/constructors and destructors) Note that the region area is 0 while the city is len*width and the country is the sum of their cities. 2. Create array of countries called Arab of 22 countries, Write a function fill that fills the arrav Arab 3. Write a method that finds the city that has the max area in a country 4. Write a method that sorts the cities in a country from the largest to the smallest area 5. Write a function that retums array of countries of the same area of Arab 6. Write a function that compares between two countries. It returns true if countryl area greater than country2 area. 7. Write a function to move a city from one country to another.Define a BankAccount classthat has• accNum (int)• Balance (double)• A constructor• Four methodso deposito withdrawo getAccNumo getBalance 2. Implement a test classTestBankAccount that• Initialize an BankAccountinstance with initial values:• deposit: 500.0• accNum: 1001• Deposit 30.50• Withdraw 50.0• Print out the remainingbalanceIn this question, we will bake a class. Create a class Cake , with the following instance attributes: • name (a string) • ingreds (a list of strings) • price (a float) The Cake class has also the following methods: • Write a constructor that takes as input a string indicating the cake name, and a list of strings indicating the cake ingredients. (No docstring needed.) The constructor uses these values to initialize the attributes accordingly. Note that each cake should be assigned a random price between $10.00 (inclusive) and $15.00 (exclusive). You may import random . Moreover, a cake must contain at least three or more ingredients. If this is not the case, the constructor should raise a ValueError . For this constructor, do not worry about making a copy of the input array. You can simply copy the reference received as input into the corresponding attribute. 1 • Write a method (including docstring) called __str__ which returns a string containing the name of the cake and its price…