Create a class called "Triangle", which is inherited from "TwoDimensionShape" abstract class. The "Triangle" class is used to calculate the Area and the Perimeter of the Equilateral triangle given its Side-length (a), or in contrast, finding the side-length (a) when the Area or the Perimeter is given. The specifications of this class are below.
Q: Design a class that acts as a library for the following kinds of media: book, video, and newspaper.…
A: Given:
Q: Create a Java Project (with a class and a test class) to represent some real-world entity such as a…
A: Source Code : //main classclass Person { //a)//member variablesString firstName;String…
Q: Suppose the class SportsCar is a derived class of a class Automobile,and suppose also that the class…
A: PARENT CLASS: Automobile Methods: accelerate, addGas DERIVED CLASS: SportsCar
Q: Write a java program to create a room class, the attributes of this class is roomno roomtype, roomar…
A: I give the code in Java along with output and code screenshot
Q: Write a class encapsulating the concept of a team (for example, "Orioles"), assuming a team has only…
A: PROGRAM EXPLANATION: Create a class Team. Define the constructor for this class. Declare an…
Q: Write a java code to create an interface named iRectangle that has 2 methods calcArea and calcPeri,…
A: Here I have created an interface named iRectangle.java and inside this interface, I have created 2…
Q: Drag and drop from the options below to declare an object of type "People", which takes a string as…
A: Declare an object of type "People", which takes a string as the first parameter for its constructor…
Q: MAT-521-Q2 Get the area of the square,circle, triangle and rectangle shapes using abstract classes…
A: let us see the answer:- Create a shape abstract class with two numbers and an empty function called…
Q: In order to implement different ways of discount strategies for an object oriented parking system,…
A: In the above specification the following assumptions are made: CarType is a class which has an…
Q: In this exercise, we are going to model some behaviors of a square. Since the Square object extends…
A: Given: In this exercise, we are going to model some behaviors of a square. Since the Square object…
Q: For this exercise, you will be completing the Account class, which simulates a regular bank account,…
A: Given, For this exercise, you will be completing the Account class, which simulates a regular bank…
Q: Write a Java program: In the board game Scrabble, each tile contains a letter, which is used to…
A: toString() method returns a string with format: letter + " with value " + value. equals() method…
Q: s that will extend the given Animal class and optionally implement a leg count interface. (Image…
A: Given : Animal.java abstract class Animal { String FUR="fur"; String FEATHER = "feather"; String…
Q: Implement the Shape hierarchy -- create an abstract class called Shape, which will be the parent…
A: Answer :-
Q: Implements an interface having three methods eat, travel, bark
A: Program Plan: Create an interface named Animal In that interface declare methods…
Q: We have to calculate the area of a rectangle, a square and a circle. Create an abstract class…
A:
Q: Which class is instantiable? Class A or Class B? abstract class A { abstract int add(int a, int b);…
A: There is a compiler Error in The Above Program. Class B must implement inherited abstract method…
Q: For this lab we once again are going to create 2 classes, 1 called Dog and 1 called Lab13B. Dog…
A: #include <bits/stdc++.h>using namespace std;class Dog{ public: int age; double…
Q: Q2. Imagine you have two classes: Employee (which represents being an employee) and Ninja (which…
A: CODE:- import java.util.*;import java.io.*;interface Check{int S=0; //statepublic void…
Q: In this exercise, we are going to model some behaviors of a square. Since the Square object extends…
A: Below is the implementation in the Java program: - Approach: - Define the class Rectangle. Declare…
Q: Create a Java Project (with a class and a test class) to represent some real-world entity such as a…
A: Code:- 1: TV.java: public class TV {private String name;private int height;private int width;private…
Q: Write a Java program to create a class Cube having attributes width, height and depth. Initialize…
A: Inheritance is an essential pillar of OOP(Object Oriented Programming). It is the technique in java…
Q: Create the class DynamicArrayOfStrings that implements the following two interfaces
A: Write a program that has the class DynamicArrayOfStrings that implements the following two…
Q: The Java feature in Q1 which create a new version of predefined method getPerimeter() is called…
A: ANSWER:- Polymorphism
Q: With the addition of electric cars, we have a need to create a subclass of our Car class. In this…
A: public class CarTester{public static void main(String[] args){// Create a Car objectCar obj1 = new…
Q: Write a class encapsulating the concept of converting integer grades to letter grades (A, B, C, D,…
A: class Test { public static void main(String[] args) { Grade grade1 = new Grade(50);…
Q: Suppose we want to implement a drawing program that creates various shapes using keyboard…
A: Given: Abstract base class DrawableShape that knows the center (two integer values) and the color (a…
Q: Implementing the speak() method in each class. Take the Dog class for example: public void speak()…
A: Java Interfaces: Interface is similar to class but the methods declared in interface are by…
Q: Define a class Job which has three property (name, salary, description) and two behavior (getSalary,…
A: ALGORITHM:- 1. Declare the Employee class. 2. Declare the two constructor method in the class. 3.…
Q: Extend the design of the class in Question 2 (a) to include a subclass, called MutatedHero, that…
A: we need to design a subclass which can be added to class,below i have written the required subclass…
Q: Create an abstract class ‘Fares’ with an abstract method ‘fareCharged()’. $10, $15 and $20 are the…
A: public abstract class Fares //declaring abstract class { public abstract void fareCharged();…
Q: Take the tax program from the last homework assignment and implement it using classes and objects…
A: The name of the class is the Customer.The customer class has two variable income and tax.The…
Q: Write a testing class to create a Cat object. Invoke the speak method by each object and check the…
A: //interface definitionpublic interface Speakable{ //method declaration public void speak();}
Q: ave to calculate the area of a rectangle, a square and a circle. Create an abstract class 'Shape'…
A: Note: Since you have not provided the language to write the code, I am using Java language to write…
Q: change their state once they are instantiated. How will you implement t
A: All objects of the classes cannot change their state once they are instantiated. How will you…
Q: In this exercise, we are going to model some behaviors of a square. Since the Square object extends…
A: Find the code for the above question below, read the comments provided in the code for better…
Q: Write Java program for given scenarios below: Create a class named 'Member' having the following…
A: Create a class named 'Member' having the following members: Data members1 - Name2 - Age3 -…
Q: Create a parent class Person with one attribute age and one method greet() that prints out "Hello,…
A: I give the code in Java (Because you have not mentioned any specific language )along with output and…
Q: Write a class encapsulating the concept of a corporate name (for example, "IBM"), assuming a…
A: The given problem is related to java programming that will have 2 classes in it. corporate class…
Q: Complete the class LeprechaunGold to model a stash of gold coins at the end of the rainbow. There is…
A: PROGRAM: LeprechaunGold.java: //Defining the class public class LeprechaunGold { //Declaring…
Q: We have a parking office class for an object-oriented parking management system using java Add…
A: Below is the code in java and explanation:
Q: This assignment starts with the Account class from Labs 4 and 5. Our new and improved bank has two…
A: package inheritance; import java.util.*; class Bank { Scanner s=new Scanner(System.in);…
Q: Write a Tourist class to work with the following piece of code: tl Tourist("John", "Smith",…
A:
Q: Implement a class RoachPopulation that simulates the growth of a roach population. The constructor…
A: class RoachPopulation{ private int population; //The constructor takes the size of the…
Q: For this exercise, you will be completing the Account class, which simulates a regular bank account,…
A: LOGIC: The given problem will have below three classes: a) Account.java: A base class to hold…
Q: Consider a class BankAccount that has • Two attributes i.e. accountID and balance and • A function…
A: Code: #include <iostream> using namespace std; // class BankAccountclass BankAccount{ //…
Q: Create an abstract class Plant which contains an abstract method called Photosyntesis()
A: Logic:- create an abstract class by defining a class name Plant. Inside this class declare an…
Q: Implement the Shape hierarchy -- create an abstract class called Shape, which will be the parent…
A: Here I have different classes as per the question. Shape class contains one abstract method…
Q: Define a class named ComparableCirclethat extends Circle and implements Comparable. Draw the UML…
A: UML stands for Unified modeling language. The tool which is used draws the class diagram and…
Q: In this challenge, we'll implement an Account class along with two derived classes, Savings and…
A: NOTE - I have used the Java programming language. Here I have created a class Account and in this, I…
ues java and show me the output
Step by step
Solved in 4 steps with 1 images
- 13.5 (Enable GeometricObject comparable) Modify the GeometricObject class to implement the Comparable interface and define a static max method in the GeometricObject class for finding the larger of two GeometricObject class. Also, draw the UML diagram and implement the new GeometricObject class. Additionally, write a test program that use the max method to find the larger of two circle, the larger of two rectangles.9.19 LAB: BankAccount class (EO) Build a class called BankAccount that manages checking and savings accounts. The class has three private member fields: a customer name (String), the customer's savings account balance (double), and the customer's checking account balance (double). Implement the following Constructor and instance methods: public BankAccount(String newName, double amt1, double amt2) - set the customer name to parameter newName, set the checking account balance to parameter amt1 and set the savings account balance to parameter amt2. (amt stands for amount) public void setName(String newName) - set the customer name public String getName() - return the customer name public void setChecking(double amt) - set the checking account balance to parameter amt public double getChecking() - return the checking account balance public void setSavings(double amt) - set the savings account balance to parameter amt public double getSavings() - return the savings account balance…(Java) Q 1,2 ANSWER BOTH PART 1 AND 2!!! Explain the answer step-by-step and include verbal explanation. Thank you! PART 1: 1. Given the below Car class, write a child class of Car named Tesla. The Tesla class has an additional private boolean variable named autoPilotEnabled. It also has two constructors - a default constructor and a three argument constructor. Both constructors call the appropriate constructors of the parent class. Tesla also has a getter and setter for the autoPilotEnabled variable. Finally, it has a toString method that calls the toString of Car, as well as concatenating the autoPilotEnabled variable. public class Car { private String make;private String model;public Car() {make = "Make unknown";model = "Model unknown";}public Car(String make, String model) {this.make = make;this.model = model;} public String getMake() {return make;}public String getModel() {return model;}public void setMake(String make) {this.make = make;}public void setModel(String model)…
- Instructions-Java Assignment is to define a class named Address. The Address class will have three private instance variables: an int named street_number a String named street_name and a String named state. Write three constructors for the Address class: an empty constructor (no input parameters) that initializes the three instance variables with default values of your choice, a constructor that takes the street values as input but defaults the state to "Arizona", and a constructor that takes all three pieces of information as input Next create a driver class named Main.java. Put public static void main here and test out your class by creating three instances of Address, one using each of the constructors. You can choose the particular address values that are used. I recommend you make them up and do not use actual addresses. Run your code to make sure it works. Next add the following public methods to the Address class and test them from main as you go: Write getters and…__21.5Write a java class that corrects a sentence. Your class must capitalize the letter in each sentence. For example: Input Result after a train crashed, every single person died. who survived?all of the couples. After a train crashed, every single person died. Who survived?All of the couples. turn us on our backs and open up our stomachs, and you will be the wisest but at the start a lummox. what are we? books. Turn us on our backs and open up our stomachs, and you will be the wisest but at the start a lummox. What are we? Books. help! help! it's an emergency. Help! Help! It's an emergency.Q5: Consider the following code. [14]class A{protected:double x;public:A(){ cout<<"Constructor of Class A"<<endl; }void Display(){cout<<"Function Display of Class A"<<endl;}virtual void Print(){cout<<"Function Print of Class A";}virtual void Show()=0;}; class B:public A{protected:double y;public:B(){cout<<"Constructor of Class B"<<endl;}void Display(){cout<<"Function Display of Class B"<<endl;}void Show(){cout<<"Function Show of Class B"<<endl;}};class C:public A{public:C(){cout<<"Constructor of Class C"<<endl;}void Display(){cout<<"Function Display of Class C"<<endl;}};class D:public B{};void main(){Line 1: A *Ptr[3];Line 2: P[0]=new A;Line 3: Ptr[1]=new B;Line 4: Ptr[2]=new C;Line 5: Ptr[1]->Show();Line 6: Ptr[1]->Display();Line 7: Ptr[1]->Print();Line 8: Ptr[2]=new D;Line 9: Ptr[2]->Show();}a) List down the abstract and concrete classes?b) Find and correct the errors in the above…
- Problem 1: Java programComplete the Clothing class, the class should have the following instance variables, constructor(s) and instance methods:- An instance variable of type double named price.- An instance variable of type String named type.- An instance variable of type String named size.- A default “no-arg” constructor that sets the price to 29.9, the type to “TShirt” and the size to “Medium”. - An overloaded constructor that takes three parameters and set the instance variables accordingly. - A method named increasePrice that takes no parameters and returns no value, the method increases the instance variable price by 5.- An overloaded method increasePrice that takes a double parameter xand returns no value, the method increases the instance variable price by the value of parameter x.- A method named details which takes no parameters, returns no value, the method prints the Clothing item details in the format shown in the sample output.- Your output should look exactly the same…Specify who can see and who can't see members of a class.3e. Update the NineToFiver class to ensure it properly extends the LocalResource class Write class LocalConsultant that extends LocalResource, and implements Citizen and Consultant. LocalConsultant exposes the following public methods: 4a. LocalConsultant(String dob, String sector, double skillPrice, double taxRate)- Saves local instance data – populates superclass data and calculates and saves a permit tax for the instance with a value given by taxRate*skillPrice. 4b. earnFromSkill():double- return the skillPrice for the instance 4c. getContact():String – return the string value obtained by joining the text “LocalConsultant#” with the id associated with the person 4d. getPay():double – returns the value obtained by subtracting the permitTax from the value earned from the skill. Attempted code class LocalConsultant extends LocalResource implements Citizen, Consultant { private String skill;private double permitTax; public LocalConsultant(String dob, String sector, double skillPrice,…
- Kindly Solve this C++ question as per the instructions. Thank you for your help! Instructions: 1- Put the class definition in Flight.h and the implementation of the constructors and functions in Flight.cpp Implement the Flight.h and Flight.cpp so that class Flight contains: 4 private instance variables: Name of data type string, which describe the three electric vehicle charger types (AC975, DL521, and AC863). Destination of data type string that shows the final destination of that flight. Hour and Minute of data type int that show the departure time. A default constructor which sets all of the numeric instance variables to zero and the String instance variables to null. A constructor with 4 parameters that sets the 4 instance variables to the corresponding values passed. Implement an accessor method for each information (Flight name, Flight destination, and Flight Time) that will return the value of the instance variable. For example, the getX() method for the instance variables…1- Write a Shopping Cart class to implement a shopping cart that you often find on websites where you could purchase some goods. Think about what things could you store in a cart and also what operations you could perform on the cart. To simplify matters, you could consider the website to be an electronics e-store that has goods like flat-panel TVs, boomboxes, iPods, camcorders, and so on. (Python code)C++ 2. Define a new "Degree" class that contains a year (integer), a subject (string), and a person’s name (string). For example, a degree can have "John Smith", 2020, and "Computer Science" It should have at least the following methods:- toString method must return all the degree information: year, subject, and person’s name.Here is an example of the formatted degree string:NAME(John Smith) SUBJECT(Computer Science) YEAR(2020) - hasTheSameDegree method compares 2 degrees and returns true if both have the same year and the same subject. Otherwise, it returns false. - isLater method that compares 2 degrees and returns true if the current degree has the year later than the 2nd degree and false otherwise. Important notes: - You can add as many other methods as you need. But this class should not provide the default constructor. - Show how this class and its methods are being used, called, and produce the correct results.