Question

In: Computer Science

A corporation has two divisions, each responsible for sales to different geographic locations. Design a DivSales...

A corporation has two divisions, each responsible for sales to different geographic locations. Design a DivSales class that keeps sales data for a division, with the following members: • An array with two elements for holding two halves of sales figures for the division. • A private static variable for holding the total corporate sales for all divisions for the entire year. • A member function that takes two arguments, each assumed to be the sales for a half year. The value of the arguments should be copied into the array that holds the sales data. The total of the two arguments should be added to the static variable that holds the total yearly corporate sales. • A function that takes an integer argument within the range of 0 to 1. The argument is to be used as a subscript into the division half-yearly sales array. The function should return the value of the array element with that subscript. Write a program that creates an array of two DivSales objects. The program should ask the user to enter the sales for two half-year for each division. After the data is entered, the program should display a table showing the division sales for each half-year. The program should then display the total corporate sales for the year.

Solutions

Expert Solution

Note: Could you plz go through this code and let me know if u need any changes in this.Thank You
_________________


// DivSales.java

public class DivSales {
   private int sales[];
   private static int totalCorporateSales=0;

   public DivSales() {
       sales = new int[2];
   }

   public void readSalesData(int num1, int num2) {
       sales[0] = num1;
       sales[1] = num2;
       totalCorporateSales += sales[0] + sales[1];
   }

   public int getHalfYearSalesData(int indx) {
       return sales[indx];
   }

   public static int getTotalCorporateSales()
   {
       return totalCorporateSales;
   }
}
___________________________

// Test.java

import java.util.Scanner;

public class Test {

   public static void main(String[] args) {

       DivSales arr[]=new DivSales[2];
       /*
       * Creating an Scanner class object which is used to get the inputs
       * entered by the user
       */
       Scanner sc = new Scanner(System.in);
int sales1,sales2;
       for(int i=0;i<arr.length;i++)
       {
   System.out.print("Enter division "+(i+1)+" sales of first half year :$");
   sales1=sc.nextInt();
   System.out.print("Enter division "+(i+1)+" sales of second half year :$");
   sales2=sc.nextInt();
   arr[i]=new DivSales();
   arr[i].readSalesData(sales1,sales2);
       }
      
       for(int i=0;i<arr.length;i++)
       {
           System.out.print("Division#"+(i+1)+" Sales:"+arr[i].getHalfYearSalesData(0)+"\t"+arr[i].getHalfYearSalesData(1)+"\n");
       }
      
       System.out.println("Total Corporate Sales :$"+DivSales.getTotalCorporateSales());
      


   }

}
______________________________

Output:

Enter division 1 sales of first half year :$4500
Enter division 1 sales of second half year :$6500
Enter division 2 sales of first half year :$2300
Enter division 2 sales of second half year :$7800
Division#1 Sales:4500   6500
Division#2 Sales:2300   7800
Total Corporate Sales :$21100

_______________Could you plz rate me well.Thank You


Related Solutions

Consider a company that has two different divisions. The annual profits from the two divisions are...
Consider a company that has two different divisions. The annual profits from the two divisions are independent and have distributions Profit1 ~ N (5, 32) and Profit2 ~ N (7, 42) respectively. Both the profits are in $ Million. Answer the following questions about the total profit of the company in Rupees. Assume that $1 = Rs. 45 A. Specify a Rupee range (centered on the mean) such that it contains 95% probability for the annual profit of the company....
Dewan INC. has several divisions, each with a manager responsible for the operations of the division....
Dewan INC. has several divisions, each with a manager responsible for the operations of the division. Each division of Dewan controls product design, sales, pricing, operating costs, and profits.. However, Dewan’s corporate management maintains control over the financial operations of the divisions by approving all capital expenditures above a small amount and by keeping tight reins on the financial reporting from the division to corporate headquarters. Each division has a corporate controller who manages the division's accounting system and provides...
Perth Corporation has two operating divisions, a casino and a hotel. The two divisions meet the...
Perth Corporation has two operating divisions, a casino and a hotel. The two divisions meet the requirements for segment disclosures. Before transactions between the two divisions are considered, revenues and costs are as follows: Casino Hotel Revenues $ 35,000,000 $ 21,000,000 Costs 16,000,000 13,000,000 The casino and the hotel have a joint marketing arrangement by which the hotel gives coupons redeemable at casino slot machines and the casino gives discount coupons good for stays at the hotel. The value of...
Advanced Widget Systems Corporation has two divisions: manufacturing and sales. A widget is an expensive semiconductor-based...
Advanced Widget Systems Corporation has two divisions: manufacturing and sales. A widget is an expensive semiconductor-based device that looks high-tech and performs no useful function. These properties make widgets very popular with corporate executives.   In the widget industry, when a new worker is hired both he and his supervisor are equally ignorant about his ability. There is no skill involved in making and marketing; however, natural ability matters a great deal. An individual assigned to marketing either sells 12 widgets...
Leapin’ Larry’s Pre-Owned Cars has two divisions, Operations and Financing. Operations is responsible for selling Larry’s...
Leapin’ Larry’s Pre-Owned Cars has two divisions, Operations and Financing. Operations is responsible for selling Larry’s inventory as quickly as possible and purchasing cars for future sale. Financing Division takes loan applications and packages loans into pools and sells them in the financial markets. It also services the loans. Both divisions meet the requirements for segment disclosures under accounting rules. Operations Division had $26 million in sales last year. Costs, other than those charged by Financing Division, totaled $16 million....
YouWin! manufacturers and sells custom wooden trophies. Each of the company’s two divisions, production and sales,...
YouWin! manufacturers and sells custom wooden trophies. Each of the company’s two divisions, production and sales, has a manager who is responsible for all costs in his/her division. The following are selected costs from YouWin!: Wood Brass ornamentation Engraving materials Adhesive for trophy production Salary of sales staff Wages of machine operators Wages of factory custodial staff Production manager’s salary Rent and insurance of factory building Rent on headquarters building Engraving machine Electricity for factory building Depreciation of office equipment...
Tops Corporation is organized into two divisions, Manufacturing and Marketing. Both divisions are considered to be...
Tops Corporation is organized into two divisions, Manufacturing and Marketing. Both divisions are considered to be profit centers and the two division managers are evaluated in large part on divisional income. The company makes a single product. It is fabricated in Manufacturing and then packaged and sold in Marketing. There is no intermediate market for the product. The monthly income statements, in thousands of dollars, for the two divisions follow. Production and sales amounted to 10,000 units. Manufacturing Marketing Revenues...
Tops Corporation is organized into two divisions, Manufacturing and Marketing. Both divisions are considered to be...
Tops Corporation is organized into two divisions, Manufacturing and Marketing. Both divisions are considered to be profit centers and the two division managers are evaluated in large part on divisional income. The company makes a single product. It is fabricated in Manufacturing and then packaged and sold in Marketing. There is no intermediate market for the product. The monthly income statements, in thousands of dollars, for the two divisions follow. Production and sales amounted to 10,000 units. Manufacturing Marketing Revenues...
Axel Corporation (which has a weighted-average cost of capital of 12%) has two divisions with the...
Axel Corporation (which has a weighted-average cost of capital of 12%) has two divisions with the following information: Beta Division Cal Division Total Assets $720,000 $550,000 Current Liabilities $220,000 $110,000 After-Tax Operating Income $105,000 $110,000 ROI 15% 20% Which of the following is true? Multiple Choice Beta is more profitable and has a higher EVA than Cal. Beta is more profitable than Cal, but Cal is generating a greater return relative to its resources than Beta. Beta has a lower...
kneeland corporation has two divisions: grocery division and convenience division. the following ... Question: Kneeland Corporation...
kneeland corporation has two divisions: grocery division and convenience division. the following ... Question: Kneeland Corporation has two divisions: Grocery Division and Convenience Division. The following ... (1 bookmark) Kneeland Corporation has two divisions: Grocery Division and Convenience Division. The following report is for the most recent operating period: Total Company Grocery Division Convenience Division Sales $ 427,000 $ 321,000 $ 106,000 Variable expenses 119,380 70,620 48,760 Contribution margin 307,620 250,380 57,240 Traceable fixed expenses 239,000 194,000 45,000 Segment margin...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT