Java Program General Scenario: You are creating an interactive application that gets input from the keyboard and keeps track of a grocery store that a businessman runs. In order to develop this application, you will be using 2 interfaces, 1 abstract class, and 1 concrete class. You should use the interfaces and the abstract class to create the concrete class. Your application should have overridden toString() at appropriate places so that you could display the object state, i.e., the string representation of the objects that you create by simply using the following command: System.out.println(object). Follow the following instructions: Create 2 interfaces: Onion and Coke. Interface Onion contains only 1 abstract method: onionPrice() which does not return any data. It takes 1 double argument: onionPrice that represents the current price (per kilo) of onion. Interface Coke contains only 1 abstract method: cokePrice() which does not return any data. It takes 1 double argument: cokePrice that represents the current price (per bottle) of coke. Create an abstract class named Businsess. This class contains 1 instance variable, 1 constructor, and 1 abstract method. Instance variable: numEmp (that will take care of the number of employees in the business. An 1-argument constructor that will be called from its subclass to load 1 instance variable of this level during the creation of an object in its subclass. 1 abstract method: numEmployee(). This method does not take any arguments. When implemented in its subclass, it is supposed to return an integer that represents the number of employees in the business. In this abstract class Business, write necessary code to get the object state (i.e., the string representation) that will eventually be called from its concrete subclass. Create a concrete class named GroceryBusiness that makes use of both the interfaces: Onion and Coke that you created earlier. This concrete class also makes use of the abstract class Business that you also created earlier. a. This concrete class GroceryBusiness has 1 instance variable of its own, 1 constructor, and 1 concrete method of its own. Instance variable: groceryIncome (Use appropriate data type) that represents the current yearly income of the grocery business. Constructor: 1 constructor that constructs a GroceryBusiness object with all the its instance variables (numEmp and groceryIncome) supplied during the GroceryBusiness object creation. 1 concrete method of its own: yearEstablished() that does not return any data. It takes 1 integer argument (year) that represents the year the grocery business was established. This method displays the year the grocery business was established from within itself. Write all necessary code to make this class a concrete class. Write necessary code to get the complete string representation (i.e., the object state) of objects made from this class. [35 marks] Create a driver class named XXXMidTest (replace XXX by three letters of your name). This driver class would prompt the user to enter current number of employees in your grocery business. It would then ask how much you earn from the grocery business. It then uses these 2 user input to create a GroceryBusiness object. It would then display the string representation of the object you just created. Then it would ask for the year the grocery business was established.. It would display the year you just entered. It would then ask for the current price of onion per kilo. And finally it would ask for the current price of coke per bottle. It would then display the prices you just entered.
In: Computer Science
In: Civil Engineering
This Code Is Supposed To Be Performed In JAVA
1.) Create an abstract class DiscountPolicy. It should have a single abstract method computeDiscount that will return the discount for the purchase of a given number of a single item. The method has two parameters, count and itemCost. Create a driver class that tests this class and provide the UML.
2.) In a separate program, define DiscountPolicy as an interface instead of the abstract class. Create a driver class that tests this class and provide the UML.
Perform The Following
1.) Create an abstract class DiscountPolicy with a single abstract method computeDiscount that will return the discount for the purchase of a given number of a single item.
2.) Create a driver class
3.) Create an interface class DiscountPolicy with a single abstract method computeDiscount that will return the discount for the purchase of a given number of a single item.
4.) Create a driver class or use the same driver class that you created earlier
In: Computer Science
Environmental health project. I am doing it on the effects of smoking and alcohol so which body system will it affect to? How does it affect the teeth, heart lungs, etc? Please start with a abstract with me. I need to write an abstract. One paragraph abstract. Thanks
In: Chemistry
write Abstract and introduction about ohm's law experiment (800-100) word:
Abstract:
Introduction:
In: Physics
package dealership;
public abstract class Vehicle {
private float dealerPrice;
private int year;
public Vehicle(float d, int y) { dealerPrice = d; year = y; }
public float getDealerPrice() { return dealerPrice; }
public int getYear() { return year; }
public abstract float getStickerPrice();
}
In the space below write a concrete class Car in the dealership package that is a subclass of Vehicle class given above.
You will make two constructors, both of which must call the superclass constructor. Make a two argument constructor (float, int) that initializes both instance variables using the arguments (think carefully about how this should be done). Make a single argument constructor (float) that initializes the dealerPrice with the float argument and initializes year to the current year (2020). Override the getStickerPrice()method so that it returns 1.5 times the dealerPrice if the year is at least 2010, and returns 1.2 times the dealerPrice if the year is older than 2010 (that is, year < 2010).
In: Computer Science
At execution time, calls to methods are resolved based on the type of the object to which the reference refers to using a process called
|
dynamic binding. |
|
|
static binding. |
|
|
symmetric binding. |
|
|
none of the above |
Classes that can be used to instantiate objects are called
|
abstract classes. |
|
|
concrete classes. |
|
|
solid classes. |
|
|
none of the above |
The keyword to use in the class declaration to indicate that it uses an interface is
|
inherits. |
|
|
implements. |
|
|
extends. |
|
|
none of the above |
The UML expresses the relationship between a class and an interface through a
|
realization relationship. |
|
|
is-a relationship. |
|
|
has-a relationship. |
|
|
none of the above |
By default, interface methods are considered
|
private and abstract. |
|
|
public and abstract. |
|
|
abstract only. |
|
|
none of the above |
In: Computer Science
JAVA Programming ECLIPSE IDE
1.
Create an abstract class called Book. The class should declare
the following variables:
an instance variable that describes the title - String
an instance variable that describes the ISBN - String
an instance variable that describes the publisher - String
an instance variable that describes the price - double
an instance variable that describes the year – integer
Provide a toString() method that returns the information stored in the above variables.
Create the getter and setter methods for each instance variable except price. Provide the necessary constructors. Include an abstract method setPrice(double price) to determine the price for a book. Include an abstract method getGenre() to return the genre of the book.
Create two subclasses called ScienceBook and ChildrenBook.
These subclasses should override the abstract methods setPrice and
getGenre of class Book.
Use the following rule for setting the price for a book:
science books will have a 10% discount per each book
children books will have a fixed price (specified by user).
Write a driver program (another class with main method) that
uses the above hierarchy. In your driver program you must implement
an interaction with the user.
Use showInputDialog method to let the user input book
information.
Use showMessageDialog method to display book information including
price and type for both science and children books.
In: Computer Science
JAVA Programming ECLIPSE IDE
1.
Create an abstract class called Book. The class should declare
the following variables:
an instance variable that describes the title - String
an instance variable that describes the ISBN - String
an instance variable that describes the publisher - String
an instance variable that describes the price - double
an instance variable that describes the year – integer
Provide a toString() method that returns the information stored in the above variables.
Create the getter and setter methods for each instance variable except price. Provide the necessary constructors. Include an abstract method setPrice(double price) to determine the price for a book. Include an abstract method getGenre() to return the genre of the book.
Create two subclasses called ScienceBook and ChildrenBook.
These subclasses should override the abstract methods setPrice and
getGenre of class Book.
Use the following rule for setting the price for a book:
science books will have a 10% discount per each book
children books will have a fixed price (specified by user).
Write a driver program (another class with main method) that
uses the above hierarchy. In your driver program you must implement
an interaction with the user.
Use showInputDialog method to let the user input book
information.
Use showMessageDialog method to display book information including
price and type for both science and children books.
In: Computer Science
If a superclass is abstract, then its subclass must implement all of the abstract methods in the superclass. Is this statement true or false?A. trueB. false
I appreciate if you add some descriptions
In: Computer Science