Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribedby java program

Tasks: 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 calculateStDev (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 X to X.): , ; mean = n 21-1(X; - 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 D E F G H 1 J ||| [ revenues expenses 100000 90000 123123 45000 300000 190000 100000 99900 90909 33333 11122 3344 200800 105100 123321 100000 90000 45000 99999 11111 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 NumberFormat 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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions