Java program to solve quadratic equations. Design a class QuadraticRoots which has following members: • Data: • Methods: • Setter functions (total 3) • Getter functions (total 3) • computeRoots • if the discriminant greater than zero --- find two distinct real roots • if the discriminant equal to zero find the real roots • if the discriminant is less than zero find the two distinct complex (imaginary) roots • should also handle the iota (i) • displayRoots • get values of a, b, c from the user and display the output for each case.
Q: Design a class named Complex for representing complex numbers with the methods add, subtract,…
A: the answer is given below:-
Q: Java code; object oriented program; private static void Togrid(source s) { grid g1 = new…
A: According to the given, it is clear that Source class has a method named addObject. The addObject()…
Q: Write a Java program to solve quadratic equations. • Design a class QuadraticRoots which has…
A: ALGORITHM:- 1. Take input values of a, b, c from user. 2. Set the values of a, b, c using setter. 3.…
Q: use the following partial class definitions: public class A1 { public int x; private int y; public…
A: subclass (child) - the class that inherits from another class superclass (parent) - the class being…
Q: In Java, implement Abstraction in the grading system. Include three different implementation methods…
A: Below i have answered:
Q: plement all the classes using Java rogramming language from the given ML Class diagram. ote: This…
A: public class Person{ private String name; private String address; //Constructor…
Q: Define an abstrat super class called Employee that contains a name (String), a social security…
A: class person { private String name; person(String s) {…
Q: Create a class Reverse with one data member called num of type int and a static method find to…
A: There are numerous approaches to reverse an array in Java. These are: Using Temp array Using…
Q: Quèstion 11 Match the following A. Public ycall a method in Java using primitive type parameters B.…
A: 1. Calling a method in java using primitive type parameters is call-by-value 2. Calling a method in…
Q: Design a class named LinearEquation for a 2-by-2 system of linear equations: ax + by = e…
A: given: The class contains:• Private double data fields a, b, c, d, e, and f.• A constructor with the…
Q: (1) Implement the class A- Write a C++ program to define a class QuadraticEquation described as…
A: Algorithm: Start Define class QuadraticEquation with private members a,b,c Define get and set…
Q: Q4. Apply the dynamic programming which studies in the class to make change for an amount N=10 using…
A: Please upvote. I am providing the correct answer below. This problem is a variation of the…
Q: Design a class named Complex for representing complex numbers Include methods add, subtract,…
A: Actually, program is an executable software that runs on a computer.
Q: Given the following Department class: class Department private: int no full time; int no part time;…
A: Note: since your question contain multiple question but we can answer only one question at a time…
Q: It is a library service program to issue book based on ISBN and book title. Identify the code smells…
A: Consider the Borrower class.
Q: Q1) Indicate whether the first function of each of the following has a smaller, same, or larger…
A: NOTE: We’ll answer the first question since the exact one wasn’t specified. Please submit a new…
Q: in c++ write aprogram to Create a class Rectangle with length and breadth as private data members…
A: Answer in step2
Q: 7-a) Danish works as a constructor. Like all constructors, he is also a beer fan. He likes beer so…
A: Given: -
Q: Design a class named LinearEquation for a 2x2 system of linear equations: ax + by = ecx + dy = f x =…
A: ax + by = ecx + dy = f x = (ed - bf)/(ad - bc ) y = (af - ec)/(ad-bc) The class contains:■ The…
Q: The mathematician Conway imagined a game, called game of life, which considered cells that are…
A: Conway imagined game Coded in PYTHON Programing
Q: Some of the outcome is correct but before it finished it show me error in need help with that.
A: The correct code is given below please see to it and run it and give thumb's up for my answers ...
Q: Solve Using JAVA Language. Consider a base class named Employee and its derived classes…
A: Java code: //creating class Employeeclass Employee { //data fields String name; int…
Q: Machine Problem: Implement Polymorphism to compute the wages of regular and contractual employees.…
A: Algorithm: Start Create a class Employee with attributes ID, Name, jobPosition, jobStatus, rate,…
Q: elow is the current implementation of TWO classes, Plant (base class) and Flower (derived class).…
A: Here's your code in python:
Q: Instruction: Given the definition of methods and fields available to the Fraction class below,…
A: It is defined as programs can be asked from control statements, array, string, oops etc. Java basic…
Q: In this project, a rational number is defined as a fraction in which the numerator and denominator…
A: Solution: Given, • Your implementation should reflect the definition of a simplified rational…
Q: write a c++ program to define a class for a calculator with data member as number1 and number2(both…
A: #include<iostream> using namespace std; class calculator{ private:…
Q: Which of the following lists of instance data are accessible in A3? a) x, y, z, a, b, q b) a, b, q…
A: Given classes and their inheritance :- Class A1 Class A2 derived from A1 Class A3 derived from A2
Q: Create a class Term. This class represents a term of a polynomial such as 2x4 where 2 is coefficient…
A: Explanation Classes Used Use of ArrayList-> Dynamic array are used for storing the elements…
Q: use the following partial class definitions: public class A1 { public int x; private int y; public…
A: instance y of class A1 is private. and A derived class doesn't inherit access to private data…
Q: Create an interface MessageEncoder that has a single abstract method encode(plainText), where…
A: // MessageEncoder.java public interface MessageEncoder { // encode and returns the given plain…
Q: choose the right answer to overcome the error public abstract class LabFinalExam 3 { public static…
A:
Q: The mathematician Conway imagined a game, called game of life, which considered cells that are…
A: The mathematician Conway imagined a game, called game of life, whichconsidered cells that are…
Q: The mathematician Conway imagined a game, called game of life, which considered cells that are…
A: Solution:-- 1)As the given question has required for the solution which is to be provided in the…
Q: Java Program Create a class Employee_Health, with data members, name, age, height, weight, diabetic…
A: i give this question answer in next step with program
Q: Consider the below UML diagram and do the following: > Comparable Computer modelName: String price:…
A: The program is written in java import java.util.*; class Computer implements…
Q: Note: It`s python coding 1. Class Implementation a) Implement a class Rectangle with two…
A: class Rectangle: # a class Rectangle def __init__(self,…
Q: Implement the concept of polymorphism in Java. • Create a class named Person o AabstractgetName()…
A: public abstract class Person{ public String name; //declare instance variable public…
Q: public class Polymorphism 2 3 public static void Animal newanimal Animal myPig = new Animal myDog =…
A: public class Polymorphism{public static void main(String [] args){Animal newAnimal = new…
Q: Refer to Example Code Ch 09-6: The reference to getMoney() in assignment 2 is to the class a. Person…
A: I have provided solution in step2.
Q: Write a class sum: There are two abstract methods, the child class these must implement methods.…
A: Note: This is a multiple-question-based problem. As per company guidelines, only the first questions…
Q: Person and Employee class are already in this activity. No need to add those classes to your code.…
A: public class Main { public static void main(String[] args) { CommissionEmployee c =…
Q: Assume that Student, Employee and Retired are all extended classes of Person, and all four classes…
A: Person p = new Person(...);int m1 = p.getMoney(); // assignment 1 this is for person class p = new…
Q: Create the UML Class diagram for the following program and Implement the program in Java. Create a…
A: We are authorized to answer one question at a time since you have not mentioned which question you…
Q: Define a Class Time with the following data members: hour, minute, and the following member…
A: As per the given problem, the following needs to be done : Define a class Time. Data members : hour…
Q: Design a struct with following members: p_num_lots, int* type pa_lots, int [] type (dynamically…
A: Initialization of a Class - ConstructorManually initializing our fields of a class can get tedious.…
Q: 2. Every circle has a center and a radius. - Given the radius, we can determine the circle's area…
A: Actually, Java is a general-purpose also class-based, object-oriented programming language designed…
Q: Class Implementation a) Implement a class FruitClass with three attributes, name, color, and taste.…
A: The problem is based on the basics of classes and objects in python programming language.
Object Oriented
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images
- A java program, with a class Rectangle with attributes length and width , each of which defaults to 2. Providemethods that calculate the rectangle’s perimeter and area. It has set and get methods for bothlength and width . The set methods should verify that length and width are each floating-pointnumbers larger than 10.0 and less than 40.0. Write a program to test class Rectangle .In Java, implement abstract classes and interface in the grading system. Include three different implementation methods in solving the grade. Kindly follow the example of coding below (abstract class should be included): Example: Enter Prelim: 30 Enter Midterm: 30 Enter Endterm: 40 --------------------- Formula: (Prelim+ Midterm + Endterm)/3 ------------------------------Write a JAVA program to model the kinds of people one finds in a university. The categories are students, teachers and teaching assistant (TAs). All these categories are kinds of Person (Person is abstract class. A teaching assistant (TA) is a student and a teacher as well. A person has a name (string). A student has grade point average GPA (between 0 to 4), the teacher has the number of scholarly papers he/she has published and the teacher assistant has the number of courses he/she assists. All the classes contain constructors with default arguments to fill all data spaces. Provide display method to print all data members of an object on the screen. Classes also contain a function called isSuccessful(). Students with a GPA over 3.5 are considered successful. This function returns true if someone is successful or false if not. In main(), define an array of Person class, which can point to students, teachers and teacher assistants. The program first asks the kind of person and then lets…
- write program in java Design an abstract class GeometricObject. GeometricObject must ensure that its children must implement calcArea() method. Design RectangleYourRegNo and CircleYourName Classes as children of GeometricObject class with overridden toString() method to return “Rectangle with w Width and h Height is drawn” OR “Circle with r Radius is drawn”. The attributes of Rectangle are length, width. The attribute of Circle is radius Hint: Area of circle=πr2 , Area of rectangle= width*lengthDo 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.In Java: The program extends the representation for rational numbers Add a test class TestSimplifiedRational Define the simplified rationals r1..r4 and initialize them with 1/2, -3/9, 10/12 and 1 Compute sum=r1+r2 and diff=r4-r3 Simplify both results Check if they are equal, using equals and comparing their numerators and denominators. What do you observe? Compare r1 with r2, r3 and r4. Print all the rational numbers and partial results.
- 4.2.3: Method definition: Volume of a pyramid. Define a method pyramidVolume with double parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the volume of a pyramid with a rectangular base. Relevant geometry equations: Volume = base area x height x 1/3Base area = base length x base width.(Watch out for integer division). import java.util.Scanner; public class CalcPyramidVolume { //answer goes here// public static void main (String [] args) { Scanner scnr = new Scanner(System.in); double userLength; double userWidth; double userHeight; userLength = scnr.nextDouble(); userWidth = scnr.nextDouble(); userHeight = scnr.nextDouble(); System.out.println("Volume: " + pyramidVolume(userLength, userWidth, userHeight)); }}USING JAVA, specify, design, and implement a class called statistician. After a statistician is initialized, it can be given a sequence of double numbers. Each number in the sequence is given to the statistician by activating a member function called next_number. For example, we can declare a statistician called s, and then give it the sequence of numbers 1.1, -2.4, 0.8 as shown here: statistician s; s.next_number(1.1); s.next_number(-2.4); s.next_number(0.8); After a sequence has been given to a statistician, there are various member funcitons to obtain infomration about the sequence. Include member functions that will provide the length of the sequence, the last number of the sequence, the sum of all the numbers in the sequence, the arithmetic mean of the numbers(i.e the sum of the numbers divided by the length of the sequence), the smallest number inthe sequence, and the largest number in the sequence. Notice that the length and sum functions can be called at any time,…Design a class named LinearEquation for a 2-by-2 system of linear equations:ax + by = e x=(ed-bf)/(ad-bc)cx + dy = f y=(af-ec)/(ad-bc)The class contains:• Private double data fields a, b, c, d, e, and f.• A constructor with the arguments for a, b, c, d, e, and f.• Six getter methods for a, b, c, d, e, and f.• Methods getX() and getY() that return the solution for the equation.• A method named isSolvable() that returns true if ad - bc is not 0. The method isSolvable() willbe called in the main, if it returns true display the calculated values for x and y by calling getX()and getY(). If the call to isSolvable() returns false, display a message that “the equation has nosolution”.Write a test Java program that prompts the user to enter a, b, c, d, e, and f and displays the result. After the valuesfor a through f are entered, create a LinearEquation object. Check to seeIf ad - bc is 0, report that “The equation has no solution”, otherwise print out the values for x and y.
- Question: Using Java (netbeans), Specify, design, and implement a class called statistician. After a statistician is initialized, it can be given a sequence of double numbers. Each number in sequence is given to the statistician by activating a method called nextNumber. For example, we can declare a statistician called s, and then give it the sequence of numbers 1.1, -2.4, 0.8 as shown here:statistician s;s.nextNumber (1.1);s.nextNumber(-2.4);s.nextNumber (0.8);After a sequence has been given a statistician, there are various methods to obtain information about the sequence. Include methods that will provide the length of the sequence, the last number of the sequence, the sum of all numbers in a sequence, the arithmetic mean of the numbers (i.e., the sum of the numbers divided by the length of the sequence), the smallest number in the sequence, and the largest number in the sequence. Notice that the length andthe sum functions can be called at anytime, even if there are no numbers in…Define a Java class namely Customer containing: Instance variables: ⁃ id. A private static instance variable of type integer initialized to 0 (id=0). ⁃ name: A private instance variable of type string. ⁃ discount: A private instance variable of type integer initialized to 10 (discount=10). Methods: ⁃ A parameterized constructor: a constructor method to initialize the name and the discount instantiated objects, the variable id incremented automatically (id=id+ 1) in each instantiate of an object Customer. ⁃ setName(xxx): acts as the set method for the attribute name ⁃ setDiscount(xxx): acts as the set method for the attribute discount (0<= discount<=100). ⁃ getld: acts as the get method for the attribute id ⁃ getName(): acts as the get method for the attribute name ⁃ getDiscount (): acts as the get method for the attribute discount ⁃ toString(): returns the attributes id, name, and discount (with using the getter methods only) in the following format: id name:…use java (ArrayList, inheritance, polymorphism, File I/O and basic Java) Student class: First, you need to design, code in Java, test and document a base class, Student. The Student class will have the following information, and all of these should be defined as Private: A first name (given name) A last name (family name/surname) Student number (ID) – an integer number (of type long) The Student class will have at least the following constructors and methods: (i) two constructors - one without any parameters (the default constructor), and one with parameters to give initial values to all the instance variables of Student. (ii) only necessary set and get methods for a valid class design. (iii) a reportGrade method, which you have nothing to report here, you can just print to the screen a message “There is no grade here.”. This method will be overridden in the respective child classes. (iv) an equals method which compares two student objects and returns true if they…