Question
Consider the following class: public class Store { public final double SALES_TAX_RATE = 0.06; private String name; public Store( String newName) { setName (newName); }
Consider the following class:
public class Store
{
public final double SALES_TAX_RATE = 0.06;
private String name;
public Store( String newName)
{
setName (newName);
}
public String getName()
{
return name;
}
public void setName(String newName)
{
Name = newName;
}
public String toString()
{
return ( "name: " + name );
}
}
Write a class (WebStore) encapsulating a web store, which inherits from class Store. A web store has the following additional attributes: an Internet address and the programming language in which the website was written. Code the constructor and the toString method of the new class. You also need to include a client class to test your code.
Write a class (GroceryStore) encapsulating a grocery store, which inherits from class Store. A grocery store has the following additional attributes: annual revenues and whether it is an independent store or part of a chain. Code the constructor and the toString method of the new class, also code a method returning the annual taxes paid by the store. You also need to include a client class to test your code.
Note: code must be written in Java. topic is inherritange
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started