Question: Output sample Write this program in Java chains - 13,728 chains - 1,004 exec-maven-plugins 3.0.0 exec (default-cli) solutions --- All companies in reverse order ---

Output sampleOutput sample Write this program in Java chains - 13,728 chains -1,004 exec-maven-plugins 3.0.0 exec (default-cli) solutions --- All companies in reverse order--- Toyota (84 yrs) Japan cars/employee - 28.18 K Renault (122 yrs)

Write this program in Java

chains - 13,728 chains - 1,004 exec-maven-plugins 3.0.0 exec (default-cli) solutions --- All companies in reverse order --- Toyota (84 yrs) Japan cars/employee - 28.18 K Renault (122 yrs) France cars/employee - 26.77 K Fizza Hut (63 yrs) USA Krispy Kreme (84 yrs) USA Ford (118 yrs) USA cars/employee - 32.67 K Coco Ichibanya (39 yrs) Japan Cafe de Coral (53 yrs) Hong Kong Cafe Amazon (19 yrs) Thailand Bonchon Chicken (19 yrs) South Korea BMW (105 yrs) Germany cars/employee - 20.77 K chains - 1,321 chains - 580 chains 2,009 chains - 281 --- Only automobile companies --- BA (105 yrs) Germany Ford (118 yrs) USA Renault (122 yrs) France Toyota (84 yrs) Japan cars/employee - 20.77 K cars/employee - 32.67 K cars/employee - 26.77 K cars/employee - 28.18 K Only fast food companies --- Bonchon Chicken ( 19 yes) South Korea Cafe Amazon (19 yrs) Thailand Cafe de Coral (53 yrs) Hong Kong Coco Ichibanya (39 yrs) Japan Krispy Kreme (84 yrs) USA Pizza Hut (63 yrs) USA chains - 281 chains - 2,009 chains - 580 chains - 1, 322 chains - 1,004 chains - 13,728 BUILD SUCCESS 1. Copy class Company to your source file **this class must not be changed class Company { protected String name, origin; protected int founded; public Company(String nm, String og, int fy) { name = nm; origin = og; founded = fy; } public void print() { /* override this in child class */ } } 2. Write classes Automobile, and Fastfood that extend Company o Automobile : add variables cars, employees, carperEmployee o FastFood : add variable chains o Other variables and methods can be added to these class 3. Write class Statistics that acts as the main class. In main method, 3.1 Create an array of 10 Company objects, e.g. Company [ ] Co 3.2 Read each line of input file into co[i]. For each line, the type of co[i] may be Automobile or Fast Food object depending on the input o Column 1 = type (A = Automobile, F = FastFood) o Column 2 = name o Column 3 = founded year o Column 4 = country of origin o Column 5 = #cars produced in millions (for Automobile) or #chains (for FastFood) o Column 6 = #employees in thousands (for Automobile) companies.txt A, BMW, 1916, Germany, 2.7, 130 F, Bonchon Chicken, 2002, South Korea, 281 F, Cafe Amazon, 2002, Thailand, 2009 F, Cafe de Coral, 1968, Hong Kong, 580 F, Coco Ichibanya, 1982, Japan, 1321 A, Ford, 1903, USA, 6.6, 202 F, Krispy Kreme, 1937, USA, 1004 F, Pizza Hut, 1958, USA, 13728 A, Renault, 1899, France, 3.4, 127 A, Toyota, 1937, Japan, 10.4, 369 3.3 Calculate the following o For both types of objects calculate age from founded year o For Automobile also calculate cars per employee (in thousands) 3.4 Print results of all Automobile/Fast Food in the reverse order of the input 3.5 Print results of only Automobile in the original order of the input 3.6 Print results of only FastFood in the original order of the input Note 1 Read the whole line into a string (e.g. str) and split at comma. Trim string before converting it to number String line scan.nextLine(); String [] buf = line.split(","); int year = Integer.parseInt(buf[2].trim()); = Note 2 To compare between 2 strings, use method equals or equalsIgnoreCase if (str.equals("A")) System.out.println("automobile"); if (str.equalsIgnoreCase("a")) System.out.println("automobile"); Note 3 To check type of object if (co[i] instanceof FastFood) System.out.println("fast food")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!