Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have three data sets labeled small, medium and large with a tester that computes the code I am suppose to provide and samples of

I have three data sets labeled small, medium and large with a tester that computes the code I am suppose to provide and samples of the results the code outputs. All this is supposed to be done using the virtual machine(VM.. ie.. Ubuntu). How can I begin to implement the code needed to run the data in the VM(Wriiten in java).

Introduction Oracle City is an island resort that is implementing an automated system to track revenues and taxes due for three types of businesses: restaurants, hotels, and convenience stores. You are to write a set of Java classes that tracks the revenues and taxes based on the specifications below. Details You need to write a set of four Java classes. The structures for these Java classes are described here: A parent class of businesses (Business) o This is an abstract class, so this class will have no concrete instance. o All instance variables must be private. This class needs to keep track of at least four (4) pieces of information: account number an integer (int) business name a string (String) the primary income a floating point value (double) the secondary income a floating point value (double) o This class must have the following API: public Business (int accountNumber, String name); // this is the constructor, it creates and registers a business public int getAccountNumber (); // return the account number of the business public void setAccountNumber (int accountNumber); // set the account number of the business public String getName (); // return the name of the business public void setName (String name); // set the name of the business public double getPrimaryIncome (); // return the accumulated primary income public double getSecondaryIncome (); // return the accumulated secondary income public void addPrimaryIncome (double amount); // add the amount to the accumulated primary income public void addSecondaryIncome (double amount); // add the amount to the accumulated secondary income abstract public abstract double getTaxDue (); // abstract method for calculating tax (this method needs to be abstract since every type of business has a different tax calculating scheme) abstract public String report (); // return a string that lists the income and tax due (see below for details)

public static Business [] getRegisteredBusinesses (); // return an array of (registered) businesses1, return an empty array (array of length zero) if no business has been registered yet public static Business findBusiness (int accountNumber); // find (registered) business by account number, return null if none found o Each type of businesses will have two types of incomes primary income and secondary income. Each of the primary income and secondary income are defined based on the type of business. o The report () method must return a string that looks like the following (see example output files provided): The first line shows the account number and name of business The second line reports the type of this business The third and the fourth lines display the primary and secondary income, respectively The fifth line displays the total income The sixth line shows the calculated tax due. All floating point values (incomes and taxes due) should be output with two (2) digits after the decimal points. (Hint: use the format method of the String class. See API documentation for details) Three subclasses, one each for restaurants, hotels, and convenience stores. o These subclasses cannot have instance variables, not even private instance variables private static constants are ok. o These subclasses should have a constructor that takes an account number and a name. o These subclasses should also implement the getTaxDue () and the report () methods to make the subclasses concrete. o These subclasses should NOT implement these methods: getAccountNumber, setAccountNumber, getName, setName, getPrimaryIncome, getSecondaryIncome, addPrimaryIncome, and addSecondaryIncome. These methods should be implemented in the superclass Business and used in the subclasses unmodified. The tax due for a restaurant is calculated as follow: o Primary income is the (non-alcoholic) food income and will be charged a tax of 6%. o Secondary income is the alcoholic income and will be charged a tax of 12%. o If the secondary income is greater than primary income, a surtax of 5% will be charged. This surtax is calculated on the total income. The tax due for a hotel is calculated as follow: o Primary income is for room income. o Secondary income is for suite income. o The larger of the two types of income will be charged a tax of 15%, while the smaller one will be charged a tax of 12%. The tax due for a convenience store is calculated as follow: o Primary income is income for everything except newspaper and will be charged a tax of 7%. o Secondary income is income for newspaper and will not be charged of any tax. All methods, except for those defined in the API described above, must be private. There cannot be any import statement in your file, except for the following (which is necessary for using the ArrayList class): import java.util.ArrayList;

data set and output results:

small data set:

101 1 60.05 202 2 67.06 101 1 60.11 202 1 294.89 102 2 37.11 612 1 19.29 201 1 346.48 201 1 434.61 102 1 95.02 101 1 42.95 202 1 323.79 202 1 132.42 202 2 417.85 102 1 58.25 202 1 140.13 202 2 213.64 101 2 37.11 201 2 195.49 101 1 46.93 202 2 92.74 201 2 100.25 202 2 93.35 101 1 43.13 201 1 436.56 202 2 312.19 201 1 172.04 101 2 113.93 201 1 68.71 201 1 322.56 101 2 92.64 202 1 417.07 201 1 186.08 612 1 11.11 201 1 180.14 201 2 208.61 102 2 113.93 201 1 420.53 102 1 29.41 201 1 337.08 612 2 18.41 202 1 212.79 201 2 88.57 102 1 116.25 102 1 108.41 102 2 79.56 101 2 100.36 201 2 231.18 202 1 328.07 612 1 29.94 101 1 39.38 612 1 17.75 101 1 81.53 612 1 46.65 201 2 75.34 202 1 345.94 101 1 80.88 102 1 39.86 201 1 60.57 102 1 103.81 102 1 64.91 202 2 135.71 202 2 269.90 102 1 54.14 612 1 14.62 101 1 77.93 102 1 61.45 201 1 169.86 612 2 5.91 102 2 118.48 612 1 24.15 102 2 101.96 201 1 295.24 102 1 108.96 612 2 18.97 202 1 169.61 201 2 151.62 612 1 5.76 201 2 377.54 101 1 20.29 201 1 388.65 202 2 203.94 201 2 273.66 101 1 44.52 612 2 15.47 202 1 359.10 201 1 112.66 202 1 208.80 102 1 106.50 101 1 67.36 102 2 45.57 201 2 130.56 201 1 196.19 201 1 260.56 612 2 37.60 202 1 251.85 201 2 313.67 102 2 44.06 612 1 8.97 202 1 124.24 612 1 26.74

data result:

Account Number: 101 (Moe's)

Business Type: Restaurant

Food Income: $665.06

Alcoholic Income: $344.04

Total Receipts: $1009.10

Total Tax Due: $81.19 Account Number: 102 (Joe's)

Business Type: Restaurant

Food Income: $946.97

Alcoholic Income: $540.67

Total Receipts: $1487.64

Total Tax Due: $121.70 Account Number: 201 (Ritz)

Business Type: HotelRoom

Income: $4388.52

Suite Income: $2146.49

Total Income: $6535.01

Total Tax Due: $915.86 Account Number: 202 (Notel Motel)

Business Type: HotelRoom

Income: $3308.70

Suite Income: $1806.38

Total Income: $5115.08

Total Tax Due: $713.07 Account Number: 612 (Six Twelve)

Business Type: Convenience StoreNewspaper

Income: $96.36

Non-newspaper Income: $204.98

Total Income: $301.34

Total Tax Due: $14.35

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

Ask how you may be of assistance.

Answered: 1 week ago

Question

Question Can a self-employed person adopt a profit sharing plan?

Answered: 1 week ago