Create an application named ShapesDemo that creates several objects that descend from an abstract class called GeometricFigure. Each GeometricFigure includes a height, a width, and an area. Provide get and set accessors for each field except area; the area is computed and is read-only. Include an abstract method called ComputeArea() that computes the area of the GeometricFigure. Next you will create three additional classes derived from the GeometricFigure class. Name these derived classes: Rectange, Square, and Triangle.
Q: Suppose you have a class named Candy imported and you instantiate an object named reeses. Also,…
A: package Candy; public class Candy { String flavor= "sweet"; public String getFlavor() { return…
Q: You are given a super class called Animal and a sub-class (derived class) called Reptilian. The…
A: the ans is an D
Q: Create a class named CarRental that contains fields that hold a renter's name, zip code, size of the…
A: Here is the code for the above problem:-
Q: A. Writing an Interface In this problem you will first write an interface and then modify classes to…
A: Let us consider a series of Java program that can modify classes to implement the interface and…
Q: You have been tasked to create a program named “artistSearchOop” that will allow a user to search…
A: Java program are used to create the applications that can be run in the different platforms. It is…
Q: Override the parent class ToString() method to include the child class’s additional data. Create a…
A: Program coding is done in C#. Please find the program below
Q: panyName, color, maxSpeed (Not more than 150) and category. Use appropriate data types and access…
A: Create a class Car with parameters companyName, color, maxSpeed (Not more than 150) andcategory. Use…
Q: The TManager class will contain only one property - the array of 18 TBooking objects. Write the…
A: An array of objects can store N number of objects of a class. Each object can be referenced using an…
Q: Now write a test program that performs the following tasks: 1. Create a Faculty object with an id of…
A: A Computer Program is a set of instructions , that can be executed by a computer to perform a…
Q: B. Menl Clas 1. The meal class is defined by two properties: a. Name b. An ArrayList of Food objects…
A: ArrayList is a collection available in util package getCalories() method in Food class will give us…
Q: game. You will create a character and then use it to battle a computer generated opponent. There are…
A: /**Move.Java**/ public class Move { private String name; private String type; private int power;…
Q: Create an application named ShapesDemo that creates several objects that descend from an abstract…
A: public abstract class GeometricFigure { //declaring instance variables protected double height;…
Q: Prugram 2 1. Write a clasS named Cicle with the following properties: a. point (x.y) h. Racius 2.…
A: The solution to the given problem is below. ***Note: According to Bartleby policy we are not…
Q: In this problem you will first write an interface and then modify classes to implement the…
A: We write the interface as shown below in GeometricSolid.java file: public interface GeometricSolid {…
Q: write an interface called polygon. this interface should have 1 method called calculate, area which…
A: interface Polygon{ //Declaring interface Polygon public void calculateArea(int length,int…
Q: Write a class called Triangle that can be used to represent a triangle. Write a class called…
A: import java.util.*; public class TriangleDemo{ public static void main ( String[] args ) {…
Q: Using the Automobile class you created Chapter 10, Programming Exercise 5A as a base, derive a…
A: using System; using System.Collections.Generic; using static System.Console; class AutomobileDemo2 {…
Q: With reference to the classes defined question #1, write a method called identifyPersons( that…
A: In this question, the coding language is not specified then we are doing this question in the Java…
Q: Question: Following the example of the Rectangle class of Chapter 9 Exercise 1, design a class named…
A: Solution: Given,
Q: Which of the following statements specify the difference between an interface and a class? O A. All…
A: Java programming: Java is one of the programming languages. The java language is used to develop…
Q: write a class called OneItemBag ( OneItemBag.java ). This class represents a bag that can hold any…
A: According to the question, we have to write code for a class called OneItemBag ( OneItemBag.java ).…
Q: Write a FractionDemo program as a Console Application that instantiates several Fraction objects and…
A: using System; public class FractionDemo { public static void Main() { Fraction…
Q: 1. The UoF ID of the student 2. The full name of the student 3. The year in which the student…
A: the java code is an given below :
Q: Create a class called FinalGrade that is used to represent the points obtained in the letter grade…
A: Since Programming Language choice is not specified, we will be answering this question using C++…
Q: Create a class called Complex for performing arithmetic with complex numbers. Complex numbers have…
A: public class Main{ public static void main(String[] args) { Complex c1=new Complex();…
Q: t have the following three features: Add a method called (addItem()) which returns whether or not…
A: Need a java code Create a class called SingleItem This class represents a bag that can hold any…
Q: 1. Create a class named Student that has fields for an ID number (idNumber), number of credit hours…
A: NOTE: SINCE THE LANGUAGE OF THE CODE IS NOT MENTIONED, I HAVE USED JAVA FOR THE SOLUTION. Import…
Q: uppose you have opened an account with an initial amount of $50 and you have to add some more amount…
A: class AddAmount{ private int amount = 50; public AddAmount() //Default Constructor {…
Q: Write a class encapsulating a board game, which inherits from Game. A board game has the following…
A: public class Client{ public static void main(String[] args) { BoardGame bg=new BoardGame("Ludo",…
Q: Let’s assume you are creating a game where multiple players are involved. You will create a Player…
A: Given: Let’s assume you are creating a game where multiple players are involved. You will create a…
Q: Create a Vehicle class for keeping current set of coordinates and calculating the distance to new…
A:
Q: Write a class named IceCreamcup that implements the Customizable interface. The class should have…
A: Write class named IceCreamCup that implements Customizable interface having the following private…
Q: 02) Design and implement a class named Triangle that extends GeometricObject. Theclass contains: •…
A: Algorithm: Start Create an abstract class named GeometricObject with data members color and filled…
Q: Following the example of the Circle class in Section 9.2 , design a class named Stock that contains:…
A: package com.java; public class Stock { private String symbol; private String name; private…
Q: Create a class called Invoice that a hardware store might use to represent an invoice for an item…
A: Code: Invoice.java: class Invoice { // a: instance variables String partNum; String desc;…
Q: In the following questions, you will write a class called Patient that uses a class called…
A: import java.util.ArrayList; public class Patient { private int id; private String name;…
Q: Design an interface named Colorable with a voidmethod named howToColor(). Every class of a colorable…
A: File name: Geo.java //class Definition public class Geo { // Main method public static…
Q: Create an 'array2D' class that encapsulates the above. Your class should contain the following…
A: Required:
Q: Create a class called Rational for performing arithmetic with fractions. Write a program to test…
A: Java Code : import java.util.Scanner; class Rational { private int numerator; private int…
Q: Create a Driver class to use your Farm and Animal classes and create instances of them. In the main…
A: Animal.java //this class encapsulates all the parameters of an animal.// All function names are self…
Q: Write an application for Nina’s Cookie Emporium named CookieDemo that declares and demonstrates…
A: Program Explanation: Include the header file. Create a class or function name cookieorder. Take the…
Q: Create a class named Player with a default name as "player", a default level as 0, and a default…
A: - Create a class named Player with a default name as "player", a default level as 0, and a default…
Q: Create an interface named ISellable that contains two methods: SalesSpeech() and MakeSale(). In each…
A: I provide the code as per your requirement and also provide the screenshot of the output
Q: • Create an interface named Movable with the following methods: moveForward, moveBackward, moveUp,…
A: Given data, 1. Create an interface named Movable with the following methods: moveForward,…
Q: Dog myDog = new Dog0; %3D myDog.name = "Sir Snuggle"; This code would work, but it is bad practice…
A: Task :- choose the correct option for given question.
Q: Following the example of the Rectangle class of Chapter 9 Exercise 1, design a class named Cuboid to…
A: public class Cuboid { private int length,width,height; Cuboid(int length,int…
Q: Write an application for Nina’s Cookie Emporium named CookieDemo that declares and demonstrates…
A: Answer: 1
Q: Your program will have a class called FlightController that is going to be derived from two base…
A: Introduction to C++ Program It is defined as a direct descendant of C programming language with…
Q: Block class The Block class inherits from Drawable and it will draw a square with a black outline at…
A: The Drawable class is implemented as shown. Class Block inherits class Drawable and implements the…
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images
- Write a program named SalespersonDemo that instantiates objects using classes named Real EstateSalesperson and GirlScout. Demonstrate that each object can use a SalesSpeech() method appropriately. Also, use a MakeSale() method two or three times with each object, and display the final contents of each objects data fields. First, create an abstract class named Salesperson. Fields include first and last names; the Salesperson constructor requires both these values. Include properties for the fields. Include a method that returns a string that holds the Salespersons full name—the first and last names separated by a space. Then perform the following Create two child classes of Salesperson: Real EstateSalesperson and Girl Scout. The Real EstateSalesperson class contains fields for total value sold in dollars and total commission earned (both of which are initialized to 0), and a commission rate field required by the class constructor. The Girl Scout class includes a field to hold the number of boxes of cookies sold, which is initialized to 0. Include properties for every field. Create an interface named ISell able that contains two methods: SalesSpeech() and MakeSale(). In each Real EstateSalesperson and Girl Scout class, implement SalesSpeech() to display an appropriate one- or two-sentence sales speech that the objects of the class could use. In the Real Estatesalesperson class, implement the MakeSale() method to accept an integer dollar value for a house, add the value to the Real EstateSalespersons total value sold, and compute the total commission earned. In the Girl Scout class, implement the MakeSale() method to accept an integer representing the number of boxes of cookies sold and add it to the total field.Create an application named ShapesDemo that creates several objects that descend from an abstract class called GeometricFigure. Each GeometricFigure includes a height, a width, and an area. Provide get and set accessors for each field except area; the area is computed and is read-only. Include an abstract method called ComputeArea() that computes the area of the GeometricFigure. Next you will create three additional classes derived from the GeometricFigure class. Name these derived classes: Rectange, Square, and Triangle Create a Rectangle is a GeometricFigure whose area is determined by multiplying width by height. Create a Square is a Rectangle in which the width and height are the same. Provide a constructor that accepts both height and width, forcing them to be equal if they are not. Provide a second constructor that accepts just one dimension and uses it for both height and width. The Square class uses the Rectangle’s ComputeArea() method. Create a Triangle is a GeometricFigure…Create a class called FinalGrade that is used to represent the points obtained in the letter grade of CSC 110 by different students. The FinalGrade class should include three pieces of information as instance variables—studentName (type String), studentID (type String), and pointsObtained (type int). Your class should have a constructor that initializes the three instance variables. Provide a set and a get method for each and every instance variable. In addition, provide a method named computeLetterGrade that returns the letter grade obtained by the student taking the pointsObtained as an argument. For the grading policy refer to CSC 110 grading scheme specified in syllabus. Write a test application named FinalGradeDriver that creates at least 3 different objects of class FinalGrade and test all the methods of class FinalGrade. Sample Output Student Name : Homer SimpsonStudent ID : S123456Points Obtained : 99Letter Grade : A Student Name : Marge SimpsonStudent ID : S234567Points…
- Java question please Create a class called Account that has the following attributes: Account Client - AccountHolder Double - Balance Date - DateCreated Account() Account(Client AccountHolder, Double Balance) getAccountHolder() - Client setAccountHolder(Client) - void getBalance() - Double deposit(Double) - Double withdrawal(Double) - Double getDateCreated() - Date toString() - String compareTo(Account) - Integer equals(Account) - Double Notes: The account holder attribute will link to the Account class that you created in problem 6. Your constructor and overloaded constructor should set the date created to the current date. Your deposit method should add to the balance Your withdrawal method should remove from the balance, as long as there is enough money to withdrawal1: create a class Pentagon, which implements the RegularPolygon interface. It should have a double field called length, as well as a constructor that initializes this length field to a given value. 2: In the main() method of Pentagon class, add the following code: RegularPolygon sq = new Square(10); RegularPolygon penta = new Pentagon(20); Write code to get the perimeter for sq and penta. 3: In the main() method defined in Q2, add this line of code: sq.getArea(); Will this code pass through compiler? What is the reason? The Java feature in Q1 which create a new version of predefined method getPerimeter() is called Polymorphism Override Overload InheritanceIn this assignment, you will implement a series of functions and classes you will need for the upcoming Ghost project. Please do your best job on this assignment as early as possible. As you will depend on the code in this assignment in the ghost project. You will be given two interfaces and two abstract classes, FileTextReader, FileTextWriter, AbstractFileMonitor, and AbstractDictionary. Your job is to create two classes the first class should be named FileManager, the second class should be named Dictionary. The FileManager will implement the interfaces FileTextReader and FileTextWriter and extend the class AbstractFileMonitor. Your class signature would look something like the following: public class FileManager extends AbstractFileMonitor implements FileTextReader, FileTextWriter{... The constructor signature of the FileManager should look like the following: public FileManager(String filePath){... The Dictionary will extend the abstract class AbstractDictionary. Your class…
- a. Write a FractionDemo program that instantiates several Fraction objects and demonstrates that their methods work correctly. Create a Fraction class with fields that hold a whole number, a numerator, and a denominator. In addition: Create properties for each field. The set access or for the denominator should not allow a 0 value; the value defaults to 1. Add three constructors. One takes three parameters for a whole number, numerator, and denominator. Another accepts two parameters for the numerator and denominator; when this constructor is used, the whole number value is 0. The last constructor is parameterless; it sets the whole number and numerator to 0 and the denominator to 1. (After construction, Fractions do not have to be reduced to proper form. For example, even though 3/9 could be reduced to 1/3, your constructors do not have to perform this task.) Add a Reduce() method that reduces a Fraction if it is in improper form. For example, 2/4 should be reduced to 1/2. Add an operator+() method that adds two Fractions. To add two fractions, first eliminate any whole number part of the value. For example, 2 1/4 becomes 9/4 and 1 3/5 becomes 8/5. Find a common denominator and convert the fractions to it. For example, when adding 9/4 and 8/5, you can convert them to 45/20 and 32/20. Then you can add the numerators, giving 77/20. Finally, call the Reduce() method to reduce the result, restoring any whole number value so the fractional part of the number is less than 1. For example, 77/20 becomes 3 17/20. Include a function that returns a string that contains a Fraction in the usual display format—the whole number, a space, the numerator, a slash (D, and a denominator. When the whole number is 0, just the Fraction part of the value should be displayed (for example, 1/2 instead of 0 1/2). If the numerator is 0, just the whole number should be displayed (for example, 2 instead of 2 0/3). b. Add an operator*() method to the Fraction class created in Exercise 11a so that it correctly multiplies two Fractions. The result should be in proper, reduced format. Demonstrate that the method works correctly in a program named FractionDemo2. c. Write a program named FractionDem03 that includes an array of four Fractions. Prompt the user for values for each. Display every possible combination of addition results and every possible combination of multiplication results for each Fraction pair (that is, each type will have 16 results).Create an application for Ninas Cookie Emporium named CookieDemo that declares and demonstrates objects of the CookieOrder class and its descendants. The CookieOrder class includes auto-implemented properties for an order number, recipients name, and cookie type (for example, chocolate chip), and fields for number of dozens ordered and price. When the field value for number of dozens ordered is set, the price field is set as $15 per dozen for the first two dozen and $13 per dozen for each dozen over two. Create a child class named Special Cookieorder, which includes a field with a description as to why the order is special (for example, gluten-free). Override the method that sets a CookieOrders price as described in part a, but also to include special handling, which is SIO for orders up to $40 and $8 for higher-priced orders. Create an application named CookieDem02 that demonstrates using several Special CookieOrder objects.In Chapter 9, you created a Contestant class for the Greenville Idol competition. The class includes a contestants name, talent code, and talent description. The competition has become so popular that separate contests with differing entry fees have been established for children, teenagers, and adults. Modify the Contestant class to contain a field that holds the entry fee for each category, and add get and set accessors. Extend the Contestant class to create three subclasses: ChildContestant, TeenContestant, and AdultContestant. Child contestants are 12 years old and younger, and their entry fee is $15. Teen contestants are between 13 and 17 years old, inclusive, and their entry fee is S20. Adult contestants are 18 years old and older, and their entry fee is $30. In each subclass, set the entry fee field to the correct value, and override the Tostring() method to return a string that includes all the contestant data, including the age category and the entry fee. Modify the GreenvilleRevenue program so that it performs the following tasks: The program prompts the user for the number of contestants in this years competition, which must be between 0 and 30. The program continues to prompt the user until a valid value is entered. The program prompts the user for names, ages, and talent codes for the contestants entered. Along with the prompt for a talent code, display a list of valid categories. Based on the age entered for each contestant, create an object of the correct type (adult, teen, or child), and store it in an array of Contestant objects. After data entry is complete, display the total expected revenue, which is the sum of the entry fees for the contestants. After data entry is complete, display the valid talent categories and then continuously prompt the user for talent codes, and display all the data for all the contestants in each category. Display an appropriate message if the entered code is not a character or a valid code.
- Implement a class called Account which defines a modified banking account that can be created with a given balance and account name. It must be able to perform the following operations in the public interface: - Accepts an amount to deposit the balance - Withdraws an amount from the balance - Returns its balance - Returns its name - Displays its name and balance Write a Java application called AccountSystem to simulate an instance of the class. You need to use deposit and withdrawal methods in this program. USING INTELLIJ IDEA COMMUNITYCreate a class named Billing that includes three overloaded computeBill()methods for a photo book store.•• When computeBill() receives a single parameter, it represents the price ofone photo book ordered. Add 8% tax, and return the total due.•• When computeBill() receives two parameters, they represent the price ofa photo book and the quantity ordered. Multiply the two values, add 8% tax,and return the total due.•• When computeBill() receives three parameters, they represent the price of aphoto book, the quantity ordered, and a coupon value. Multiply the quantityand price, reduce the result by the coupon value, and then add 8% tax andreturn the total due.Write a main() method that tests all three overloaded methods. Save theapplication as Billing.java.Create a class called Complex for performing arithmetic with complex numbers. Complex numbers have the form realPart + imaginaryPart * i where i is -1 Write a program to test your class. Use floating-point variables to represent the private data of the class. Provide a constructor that enables an object of this class to be initialized when it is declared. Provide a no-argument constructor with default values in case no initializers are provided. Provide public methods that perform the following operations: a) Add two Complex numbers: The real parts are added together and the imaginary parts are added together. b) Subtract two Complex numbers: The real part of the right operand is subtracted from the real part of the left operand, and the imaginary part of the right operand is sub- tracted from the imaginary part of the left operand. c) Print Complex numbers in the form (a, b), where a is the real part and b is the imaginary part.