Sample output:
Enter number of guests: 40
40 guests have been invited.
Enjoy the party!
Sample output:
Enter number of guests: 40
40 guests have been invited.
Enjoy the party!
I need help with this question
Refer to the file cars_data.txt. It consists of a dataset of about 400 cars with 8 characteristics such as horsepower, acceleration,etc. The first line contains the different details that are stored in the file and the second line contains the data type for each information. As from the third line the actual values about the 8 characteristics are stored.
You are required to write a complete Java program that will:
(a) Create 8 parallel arrays to store 8 information pieces about the 400 cars or two-dimensional arrays, using the type provided in the second line, in the main() function
(b) Read the file cars_data.txt and fill the 8 arrays created in (a); you may use a function for that.
(c) Provide a menu to the user with following options:
(d) create a main function which will call the functions in (c)
Car,MPG,Cylinders,Displacement,Horsepower,Weight,Acceleration,Model,Origin
String,double,int,double,double,double,double,int,String
Chevrolet Chevelle Malibu,18,8,307,130,3504,12,70,US
Buick Skylark 320,15,8,350,165,3693,11.5,70,US
Plymouth Satellite,18,8,318,150,3436,11,70,US
AMC Rebel SST,16,8,304,150,3433,12,70,US
Ford Torino,17,8,302,140,3449,10.5,70,US
Ford Galaxie 500,15,8,429,198,4341,10,70,US
Chevrolet Impala,14,8,454,220,4354,9,70,US
Plymouth Fury iii,14,8,440,215,4312,8.5,70,US
Pontiac Catalina,14,8,455,225,4425,10,70,US
AMC Ambassador DPL,15,8,390,190,3850,8.5,70,US
Citroen DS-21 Pallas,0,4,133,115,3090,17.5,70,Europe
Chevrolet Chevelle Concours (sw),0,8,350,165,4142,11.5,70,US
Ford Torino (sw),0,8,351,153,4034,11,70,US
Plymouth Satellite (sw),0,8,383,175,4166,10.5,70,US
AMC Rebel SST (sw),0,8,360,175,3850,11,70,US
Dodge Challenger SE,15,8,383,170,3563,10,70,US
Plymouth 'Cuda 340,14,8,340,160,3609,8,70,US
Ford Mustang Boss 302,0,8,302,140,3353,8,70,US
Chevrolet Monte Carlo,15,8,400,150,3761,9.5,70,US
Buick Estate Wagon (sw),14,8,455,225,3086,10,70,US
Toyota Corolla Mark ii,24,4,113,95,2372,15,70,Japan
Plymouth Duster,22,6,198,95,2833,15.5,70,US
AMC Hornet,18,6,199,97,2774,15.5,70,US
Ford Maverick,21,6,200,85,2587,16,70,US
Datsun PL510,27,4,97,88,2130,14.5,70,Japan
Volkswagen 1131 Deluxe Sedan,26,4,97,46,1835,20.5,70,Europe
Peugeot 504,25,4,110,87,2672,17.5,70,Europe
Audi 100 LS,24,4,107,90,2430,14.5,70,Europe
Saab 99e,25,4,104,95,2375,17.5,70,Europe
BMW 2002,26,4,121,113,2234,12.5,70,Europe
AMC Gremlin,21,6,199,90,2648,15,70,US
Ford F250,10,8,360,215,4615,14,70,US
Chevy C20,10,8,307,200,4376,15,70,US
Dodge D200,11,8,318,210,4382,13.5,70,US
Hi 1200D,9,8,304,193,4732,18.5,70,US
Datsun PL510,27,4,97,88,2130,14.5,71,Japan
Chevrolet Vega 2300,28,4,140,90,2264,15.5,71,US
Toyota Corolla,25,4,113,95,2228,14,71,Japan
Ford Pinto,25,4,98,0,2046,19,71,US
Volkswagen Super Beetle 117,0,4,97,48,1978,20,71,Europe
AMC Gremlin,19,6,232,100,2634,13,71,US
Plymouth Satellite Custom,16,6,225,105,3439,15.5,71,US
Chevrolet Chevelle Malibu,17,6,250,100,3329,15.5,71,US
Ford Torino 500,19,6,250,88,3302,15.5,71,US
AMC Matador,18,6,232,100,3288,15.5,71,US
Chevrolet Impala,14,8,350,165,4209,12,71,US
Pontiac Catalina Brougham,14,8,400,175,4464,11.5,71,US
Ford Galaxie 500,14,8,351,153,4154,13.5,71,US
Plymouth Fury iii,14,8,318,150,4096,13,71,US
Dodge Monaco (sw),12,8,383,180,4955,11.5,71,US
Ford Country Squire (sw),13,8,400,170,4746,12,71,US
Pontiac Safari (sw),13,8,400,175,5140,12,71,US
AMC Hornet Sportabout (sw),18,6,258,110,2962,13.5,71,US
Chevrolet Vega (sw),22,4,140,72,2408,19,71,US
Pontiac Firebird,19,6,250,100,3282,15,71,US
Ford Mustang,18,6,250,88,3139,14.5,71,US
Mercury Capri 2000,23,4,122,86,2220,14,71,US
Opel 1900,28,4,116,90,2123,14,71,Europe
Peugeot 304,30,4,79,70,2074,19.5,71,Europe
Fiat 124B,30,4,88,76,2065,14.5,71,Europe
Toyota Corolla 1200,31,4,71,65,1773,19,71,Japan
Datsun 1200,35,4,72,69,1613,18,71,Japan
Volkswagen Model 111,27,4,97,60,1834,19,71,Europe
Plymouth Cricket,26,4,91,70,1955,20.5,71,US
Toyota Corolla Hardtop,24,4,113,95,2278,15.5,72,Japan
Dodge Colt Hardtop,25,4,97.5,80,2126,17,72,US
Volkswagen Type 3,23,4,97,54,2254,23.5,72,Europe
Chevrolet Vega,20,4,140,90,2408,19.5,72,US
Ford Pinto Runabout,21,4,122,86,2226,16.5,72,US
Chevrolet Impala,13,8,350,165,4274,12,72,US
Pontiac Catalina,14,8,400,175,4385,12,72,US
Plymouth Fury III,15,8,318,150,4135,13.5,72,US
Ford Galaxie 500,14,8,351,153,4129,13,72,US
AMC Ambassador SST,17,8,304,150,3672,11.5,72,US
Mercury Marquis,11,8,429,208,4633,11,72,US
Buick LeSabre Custom,13,8,350,155,4502,13.5,72,US
Oldsmobile Delta 88 Royale,12,8,350,160,4456,13.5,72,US
Chrysler Newport Royal,13,8,400,190,4422,12.5,72,US
Mazda RX2 Coupe,19,3,70,97,2330,13.5,72,Japan
AMC Matador (sw),15,8,304,150,3892,12.5,72,US
Chevrolet Chevelle Concours (sw),13,8,307,130,4098,14,72,US
Ford Gran Torino (sw),13,8,302,140,4294,16,72,US
Plymouth Satellite Custom (sw),14,8,318,150,4077,14,72,US
Volvo 145e (sw),18,4,121,112,2933,14.5,72,Europe
Volkswagen 411 (sw),22,4,121,76,2511,18,72,Europe
Peugeot 504 (sw),21,4,120,87,2979,19.5,72,Europe
Renault 12 (sw),26,4,96,69,2189,18,72,Europe
Ford Pinto (sw),22,4,122,86,2395,16,72,US
Datsun 510 (sw),28,4,97,92,2288,17,72,Japan
Toyota Corolla Mark II (sw),23,4,120,97,2506,14.5,72,Japan
Dodge Colt (sw),28,4,98,80,2164,15,72,US
Toyota Corolla 1600 (sw),27,4,97,88,2100,16.5,72,Japan
Buick Century 350,13,8,350,175,4100,13,73,US
AMC Matador,14,8,304,150,3672,11.5,73,US
Chevrolet Malibu,13,8,350,145,3988,13,73,US
Ford Gran Torino,14,8,302,137,4042,14.5,73,US
Dodge Coronet Custom,15,8,318,150,3777,12.5,73,US
Mercury Marquis Brougham,12,8,429,198,4952,11.5,73,US
Chevrolet Caprice Classic,13,8,400,150,4464,12,73,US
Ford LTD,13,8,351,158,4363,13,73,US
Plymouth Fury Gran Sedan,14,8,318,150,4237,14.5,73,US
Chrysler New Yorker Brougham,13,8,440,215,4735,11,73,US
Buick Electra 225 Custom,12,8,455,225,4951,11,73,US
AMC Ambassador Brougham,13,8,360,175,3821,11,73,US
Plymouth Valiant,18,6,225,105,3121,16.5,73,US
Chevrolet Nova Custom,16,6,250,100,3278,18,73,US
AMC Hornet,18,6,232,100,2945,16,73,US
Ford Maverick,18,6,250,88,3021,16.5,73,US
Plymouth Duster,23,6,198,95,2904,16,73,US
Volkswagen Super Beetle,26,4,97,46,1950,21,73,Europe
Chevrolet Impala,11,8,400,150,4997,14,73,US
Ford Country,12,8,400,167,4906,12.5,73,US
Plymouth Custom Suburb,13,8,360,170,4654,13,73,US
Oldsmobile Vista Cruiser,12,8,350,180,4499,12.5,73,US
AMC Gremlin,18,6,232,100,2789,15,73,US
Toyota Camry,20,4,97,88,2279,19,73,Japan
Chevrolet Vega,21,4,140,72,2401,19.5,73,US
Datsun 610,22,4,108,94,2379,16.5,73,Japan
Mazda RX3,18,3,70,90,2124,13.5,73,Japan
Ford Pinto,19,4,122,85,2310,18.5,73,US
Mercury Capri v6,21,6,155,107,2472,14,73,US
Fiat 124 Sport Coupe,26,4,98,90,2265,15.5,73,Europe
Chevrolet Monte Carlo S,15,8,350,145,4082,13,73,US
Pontiac Grand Prix,16,8,400,230,4278,9.5,73,US
Fiat 128,29,4,68,49,1867,19.5,73,Europe
Opel Manta,24,4,116,75,2158,15.5,73,Europe
Audi 100LS,20,4,114,91,2582,14,73,Europe
Volvo 144ea,19,4,121,112,2868,15.5,73,Europe
Dodge Dart Custom,15,8,318,150,3399,11,73,US
Saab 99le,24,4,121,110,2660,14,73,Europe
Toyota Mark II,20,6,156,122,2807,13.5,73,Japan
Oldsmobile Omega,11,8,350,180,3664,11,73,US
Plymouth Duster,20,6,198,95,3102,16.5,74,US
Ford Maverick,21,6,200,0,2875,17,74,US
AMC Hornet,19,6,232,100,2901,16,74,US
Chevrolet Nova,15,6,250,100,3336,17,74,US
Datsun B210,31,4,79,67,1950,19,74,Japan
Ford Pinto,26,4,122,80,2451,16.5,74,US
Toyota Corolla 1200,32,4,71,65,1836,21,74,Japan
Chevrolet Vega,25,4,140,75,2542,17,74,US
Chevrolet Chevelle Malibu Classic,16,6,250,100,3781,17,74,US
AMC Matador,16,6,258,110,3632,18,74,US
Plymouth Satellite Sebring,18,6,225,105,3613,16.5,74,US
Ford Gran Torino,16,8,302,140,4141,14,74,US
Buick Century Luxus (sw),13,8,350,150,4699,14.5,74,US
Dodge Coronet Custom (sw),14,8,318,150,4457,13.5,74,US
Ford Gran Torino (sw),14,8,302,140,4638,16,74,US
AMC Matador (sw),14,8,304,150,4257,15.5,74,US
Audi Fox,29,4,98,83,2219,16.5,74,Europe
Volkswagen Dasher,26,4,79,67,1963,15.5,74,Europe
Opel Manta,26,4,97,78,2300,14.5,74,Europe
Toyota Corolla,31,4,76,52,1649,16.5,74,Japan
Datsun 710,32,4,83,61,2003,19,74,Japan
Dodge Colt,28,4,90,75,2125,14.5,74,US
Fiat 128,24,4,90,75,2108,15.5,74,Europe
Fiat 124 TC,26,4,116,75,2246,14,74,Europe
Honda Civic,24,4,120,97,2489,15,74,Japan
Subaru,26,4,108,93,2391,15.5,74,Japan
Fiat x1.9,31,4,79,67,2000,16,74,Europe
Plymouth Valiant Custom,19,6,225,95,3264,16,75,US
Chevrolet Nova,18,6,250,105,3459,16,75,US
Mercury Monarch,15,6,250,72,3432,21,75,US
Ford Maverick,15,6,250,72,3158,19.5,75,US
Pontiac Catalina,16,8,400,170,4668,11.5,75,US
Chevrolet Bel Air,15,8,350,145,4440,14,75,US
Plymouth Grand Fury,16,8,318,150,4498,14.5,75,US
Ford LTD,14,8,351,148,4657,13.5,75,US
Buick Century,17,6,231,110,3907,21,75,US
Chevrolete Chevelle Malibu,16,6,250,105,3897,18.5,75,US
AMC Matador,15,6,258,110,3730,19,75,US
Plymouth Fury,18,6,225,95,3785,19,75,US
Buick Skyhawk,21,6,231,110,3039,15,75,US
Chevrolet Monza 2+2,20,8,262,110,3221,13.5,75,US
Ford Mustang II,13,8,302,129,3169,12,75,US
Toyota Corolla,29,4,97,75,2171,16,75,Japan
Ford Pinto,23,4,140,83,2639,17,75,US
AMC Gremlin,20,6,232,100,2914,16,75,US
Pontiac Astro,23,4,140,78,2592,18.5,75,US
Toyota Corolla,24,4,134,96,2702,13.5,75,Japan
Volkswagen Dasher,25,4,90,71,2223,16.5,75,Europe
Datsun 710,24,4,119,97,2545,17,75,Japan
Ford Pinto,18,6,171,97,2984,14.5,75,US
Volkswagen Rabbit,29,4,90,70,1937,14,75,Europe
AMC Pacer,19,6,232,90,3211,17,75,US
Audi 100LS,23,4,115,95,2694,15,75,Europe
Peugeot 504,23,4,120,88,2957,17,75,Europe
Volvo 244DL,22,4,121,98,2945,14.5,75,Europe
Saab 99LE,25,4,121,115,2671,13.5,75,Europe
Honda Civic CVCC,33,4,91,53,1795,17.5,75,Japan
Fiat 131,28,4,107,86,2464,15.5,76,Europe
Opel 1900,25,4,116,81,2220,16.9,76,Europe
Capri ii,25,4,140,92,2572,14.9,76,US
Dodge Colt,26,4,98,79,2255,17.7,76,US
Renault 12tl,27,4,101,83,2202,15.3,76,Europe
Chevrolet Chevelle Malibu Classic,17.5,8,305,140,4215,13,76,US
Dodge Coronet Brougham,16,8,318,150,4190,13,76,US
AMC Matador,15.5,8,304,120,3962,13.9,76,US
Ford Gran Torino,14.5,8,351,152,4215,12.8,76,US
Plymouth Valiant,22,6,225,100,3233,15.4,76,US
Chevrolet Nova,22,6,250,105,3353,14.5,76,US
Ford Maverick,24,6,200,81,3012,17.6,76,US
AMC Hornet,22.5,6,232,90,3085,17.6,76,US
Chevrolet Chevette,29,4,85,52,2035,22.2,76,US
Chevrolet Woody,24.5,4,98,60,2164,22.1,76,US
Volkswagen Rabbit,29,4,90,70,1937,14.2,76,Europe
Honda Civic,33,4,91,53,1795,17.4,76,Japan
Dodge Aspen SE,20,6,225,100,3651,17.7,76,US
Ford Grenada ghia,18,6,250,78,3574,21,76,US
Pontiac Ventura SJ,18.5,6,250,110,3645,16.2,76,US
AMC Pacer d/l,17.5,6,258,95,3193,17.8,76,US
Volkswagen Rabbit,29.5,4,97,71,1825,12.2,76,Europe
Datsun B-210,32,4,85,70,1990,17,76,Japan
Toyota Corolla,28,4,97,75,2155,16.4,76,Japan
Ford Pinto,26.5,4,140,72,2565,13.6,76,US
Volvo 245,20,4,130,102,3150,15.7,76,Europe
Plymouth Volare Premier v8,13,8,318,150,3940,13.2,76,US
Peugeot 504,19,4,120,88,3270,21.9,76,Europe
Toyota Mark II,19,6,156,108,2930,15.5,76,Japan
Mercedes-Benz 280s,16.5,6,168,120,3820,16.7,76,Europe
Cadillac Seville,16.5,8,350,180,4380,12.1,76,US
Chevrolet C10,13,8,350,145,4055,12,76,US
Ford F108,13,8,302,130,3870,15,76,US
Dodge D100,13,8,318,150,3
A case where inheritance is obviously appropriate. You want a base class of Party from which BdayParty inherits. Different languges have differences in how to do object oriented design. C++ is straightforward but in Javascript I'd make a module for the BdayParty to use another module named Party internally if I was interested in other parties later. If it is a one-off program to solve a particular problem I'd not bother with inheritance and just make one class or module.
It would have been very interesting to see an attempt on answering the above
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.