Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For java program: Politicians like to talk about helping middle class and tax wealthy people more. Say that they would like to do something similar,

For java program:

image text in transcribedimage text in transcribedimage text in transcribed

Politicians like to talk about helping middle class and tax wealthy people more. Say that they would like to do something similar, but for companies. They want to identify wealthier companies (to add an extra tax to them) and poorer companies (to give them a tax reduction). You want to write an application that will identify such companies. First, you should create a "Company" class to hold 3 instance variables: the name of the company (as String), their revenues and their expenses (both as double). The class should also contain the following methods: a constructor (for all 3 variables), an accessor method for the name, a method that returns the profit (as revenues minus expenses), and a toString method (prints the name of the company, followed by the profit amount in parentheses - profit calculated by calling the proper method). Then, your driver class should have a main method and the following two methods implemented: static double calculateMean (Company[] list) static double calculateSt Dev (Company[] list, double mean) Note: by making these methods "static", it will be possible to call them directly from the main method Those methods should implement the following formula respectively (assuming that the values are X1 to Xn): mean = 2?=1 X 21-1(Xi mean) stdev = n Your main method should first create an array of Company, with the following data entered (note: you can hardcode those in your code when creating the objects): name A B revenues expenses 100000 90000 123123 45000 300000 190000 10000099900 90909 33333 11122 3344 200800105100 123321 100000 90000 45000 9999911111 Then you should have the proper code to get the following output: The mean is $51,648.60 The standard deviation is $38,250.96 Wealthy companies: C(110000.0) G (95700.0) There are 2 such companies Poorer companies: A (10000.0) D (100.0) F (7778.0) There are 3 such companies In particular: 1. Your main method should make the proper calls to the 2 static methods specified above. 2. The mean and the stdev should be printed nicely with the Number Format class. 3. The list of wealthy companies are the ones with a profit higher than the mean + stdev. 4. The list of poorer companies are the ones with a profit lower than the mean stdev. 5. For steps 3 and 4 above, you should use the method that calculates profits and the toString method 6. No marks given if any of the things above are hardcoded (except for creating all Company objects)

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

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions