Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE READ DIRECTIONS THOROUGHLY Please do in java as simply as possible with the code available for copy and with comments . This isn't really

PLEASE READ DIRECTIONS THOROUGHLY

Please do in java as simply as possible with the code available for copy and with comments.

This isn't really an advanced class so please keep codes as simple as possible.

the comments are important. comments should label each part of the code.

Also, provide a screenshot of the code compiling please.

Write a class Store which includes the attributes: store name and sales tax rate. Write another class encapsulating a Yarn Store, which inherits from Store. A Yarn Store has the following additional attributes: how many skeins of yarn are sold every year and the average price per skein.

Code the constructor, accessors, mutators, toString and equals method of the super class Store and the subclass Yarn Store; In the Yarn Store class, also code a method returning the average taxes per year.

You should create a test class which creates 1 Store object and 2 Yarn Store objects, then calls your set methods, get methods, toString and equals methods and average taxes per year for the Yarn Store objects.

----------------------------------------

The outputs in the screenshots shown thus far have been correct, its just that there are errors in the code. image text in transcribedimage text in transcribedimage text in transcribedit seems like there is a method to "getStoreName()" or " getTaxRate()". Also, in line 14, is it possible to not use this "super(StoreName, taxRate) but something more simple?" Lastly, could you code so user enters values, not have them hard coded?

2 public class YarnStore // instance variables Ovo AWNE private int numberOfSkeinsSold; private double averagePricePerskein; // constructor public YarnStore(String storeName, double taxRate, int numberOfSkeinssold, double averagePricePerSkein) { 14 superstoreName,mtaxRate) this.numberOfSkeinsSold = numberOfSkeinsSold; this. averagePricePerSkein = averagePricePerSkein; 22 // getters and setters public int getNumberOfSkeinsSold() { return numberOfSkeinsSold; 46 47 480 49 50 public double average TaxesPerYear() { return numberOfSkeinsSold * averagePricePerSkein * getTaxRate(); // equals method -560 public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) ThutoString method 83 4284 85 4860 87 public String toString() { 0288 89 return "Yarnstore [storeName=" + getStoreName() + ", taxRate=" + getTaxRate() + ", numberOfSkeinsSold=" + numberOfSkeinssold + ", averagePricePerSkein=" + averagePricePerSkein + "]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building The Data Warehouse

Authors: W. H. Inmon

4th Edition

0764599445, 978-0764599446

More Books

Students also viewed these Databases questions

Question

Presentation Aids Practicing Your Speech?

Answered: 1 week ago