Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CAN SOMEONE CODE THIS PLEASE? PROGRAM INSTRUCTIONS: Create a program that stores the stats for a companys stores. Create 3 separate class files in a

CAN SOMEONE CODE THIS PLEASE?

PROGRAM INSTRUCTIONS: Create a program that stores the stats for a companys stores. Create 3 separate class files in a project folder; declare variables at the class level; create and use a one- dimensional (1D) class array; use the for loops to populate the array and the enhanced for to extract data from the array; and code multiple methods.

You are creating 3 separate .java files to be stored in the project folder:

a. TeamMember.javacontainsonlythemain()

b. CompanyStores.java

c. Store.java

3. The fields/class variables are non-static. All methods are non-static except for the main(). The main() will instantiate (create) an object of the CompanyStores class and use that object to call start(). Make sure you exit main().

4. The CompanyStores class will have 4 methods: an empty constructor, start(), processStoreInfo() and displayStoreStats(). You will create a 1D array called myStores at the class level as a null array. The type for this array will be Store.

a. start() contains a local variable called answer that holds the response to prompt 1. Based on that response processStoreInfo() and displayStoreStats() are called or a Thank you ... message is printed.

b. In processStoreInfo(), the user will be prompted for the name of the company and the number of stores. That number gives size to the myStores array. The array will then be populated with information for multiple stores.

c. displayStoreStats() has 3 local variables: salesDifference, message, and report that is initialized to the header in the final output specifications. The sales difference is calculated by subtracting a stores projected annual sales from its total quarterly sales. The difference is then used to determine which of 2 messages is stored in the message variable to be printed with the store information. An enhanced for loop is used to access each stores information from the array.

5. The Store class will have the set methods to capture the stores information and the get methods to return the captured data.

Code an empty constructor

Code an overloaded constructor that accepts the location of the store and its manager. Assign the parameter variables to class variables of the same name.

Code setStoreLctn() that prompts for the stores location and receives the loop-control value from the loop that calls the set methods in CompanyStores.

Code setManager() that prompts for the managers name and receives the loop-control value from the loop that calls the set methods in CompanyStores.

Code setTotalQtrlySales() that prompts for each quarters sales and adds it to a totalQtrlySales variable. It also receives the loop-control value from the loop that calls the set methods in CompanyStores.

Code setProjectedAnnualSales() that prompts for the stores projected annual sales.

Code get methods for each class variable for which there are set methods. These get methods only return the fields.

6. Code at the class level only those variables that need to be used by more than one method. There are 4 class variables for CompanyStores and 5 for Store.

7. In the Store class, the get methods return. One of the constructors and the set methods receive values. There are NO value-returning and/or value-receiving methods in the CompanyStores class.

PROMPTS:

Code the bold from the prompts below in the printf statements that capture data into your program. Once again, the prompts tell you your input variables. Keep in mind that these prompts are not all in the same class.

1st Prompt: Code in start().

Do you want to track the sales performance of your store(s)? Enter Y or N:

If the answer to the above question is "N" display the following message:

Thank you! Exiting program.

If the answer is "Y" then proceed to prompts 2 through 7.

2nd Prompt: Code in processStoreInfo().

What is the name of your company?

3rd Prompt: Code in processStoreInfo().

How many stores do you have?

4th Prompt: Code in setStoreLctn() where the 9 represents the store number, such as 1, 2, etc.

Enter the location for store 9:

5th Prompt: Code in setManager().

Enter the name of the manager for store 9:

6th Prompt: Code in setTotalQtrlySales() where the xxx represents 1st, 2nd, 3rd, and 4th.

Enter the sales revenue for the xxx quarter of store 9:

7th Prompt: Code in setProjectedAnnualSales().

What is the projected annual sales for store 9?

FINAL OUTPUT SPECIFICATIONS:

The output will print the header with the companys name then the stats for the stores where the Xs represent the company name, store location, and manager name. The Zs and 9s represent the output as formatted numbers. Zs indicate zero-suppression of leading numbers and 9s represent the printing of any number from 0 through 9. The header should be triple-line advanced from the last prompt or output.

The printing of the output will be in a method called displayStoreStats().

SALES FOR TANDEM AT ALL LOCATIONS

Store: Xxxxxxxxxxxx @ Xxxxxxxxxxxx

Manager: Xxxxxxxxxxxx

Projected Annual Sales: $ZZZ,ZZZ,ZZZ,ZZ9.99

Total Quarterly Sales: Z,ZZZ,ZZZ,ZZ9.99

Difference: $ZZZ,ZZZ,ZZ9.99

Performance: Xxxxxxxxxxxx

Store: Xxxxxxxxxxxx @ Xxxxxxxxxxxx

Manager: Xxxxxxxxxxxx

Projected Annual Sales: $ZZZ,ZZZ,ZZZ,ZZ9.99

Total Quarterly Sales: Z,ZZZ,ZZZ,ZZ9.99

Difference: $ZZZ,ZZZ,ZZ9.99

Performance: Xxxxxxxxxxxx

SAMPLE OUTPUT:

Do you want to track the sales performance of your store(s)? Enter 'Y' or 'N': n

Thank you! Exiting program.

********************************************************************

Do you want to track the sales performance of your store(s)? Enter 'Y' or 'N': y

What is the name of your company? tandem

How many stores do you have? 2

Enter the location for store 1: DeZavala & I10

Enter the name of the manager for store 1: Carmen Vasquez

Enter the sales revenue for the 1st quarter of store 1: 25000

Enter the sales revenue for the 2nd quarter of store 1: 28000

Enter the sales revenue for the 3rd quarter of store 1: 30000

Enter the sales revenue for the 4th quarter of store 1: 29000

What is the projected annual sales for store 1? 100000

Enter the location for store 2: 281 & 1604

Enter the name of the manager for store 2: Diego Garza

Enter the sales revenue for the 1st quarter of store 2: 30000

Enter the sales revenue for the 2nd quarter of store 2: 25000

Enter the sales revenue for the 3rd quarter of store 2: 28000

Enter the sales revenue for the 4th quarter of store 2: 35000

What is the projected annual sales for store 2? 125000

SALES FOR TANDEM AT ALL LOCATIONS

Store: TANDEM @ DeZavala & I10

Manager: Carmen Vasquez

Projected Annual Sales: $100,000.00

Total Quarterly Sales: 112,000.00

Difference: $12,000.00

Performance: KEEP UP THE GOOD WORK! Your store is ahead of your annual sales projections or right on target.

Store: TANDEM @ 281 & 1604

Manager: Diego Garza

Projected Annual Sales: $125,000.00

Total Quarterly Sales: 118,000.00

Difference: $-7,000.00

Performance: WARNING! Your store sales are below annual projections.

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_2

Step: 3

blur-text-image_3

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 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

Students also viewed these Databases questions

Question

How many three-digit numbers are divisible by 7?

Answered: 1 week ago

Question

What is Indian Polity and Governance ?

Answered: 1 week ago