New Page 1 Hi Guys I really need a
help in this java program. anyone if u can do it please please help me. thanks
Objectives:
For this assignment you will:
1) Write a Java program that involves file input and output.
2) Use GUI Java components to create an event-driven applications
3) Use testing strategies to thoroughly test algorithms that are developed.
Suggestions:
You have been hired to develop a computer-based nutrition management program.
Your program will read a text file to create Food objects which will consist of
a food name, a serving size, and a number of calories. A text file is read which
contains the calories contained in specific food items. From this data, an array
of Food objects will be created and used to populate a combo box for user
selection. The Food objects will also be used in calculating the balance
calories for a given user on a given day.
User input will be used to create User objects which will be user name, age,
gender, height, weight, and Food Diary objects (composition). The Food Diary
objects will consist of Date (composition), Food object (composition), number of
servings, and a balance. Food Diary objects will consist of the activity on any
given day (see text area in sample output screen below). All User objects are
saved to a file as objects and can be retrieved on subsequent runs of the
program.
The program will calculate the number of calories the user is allowed per day to
maintain the user’s current weight (see below for formula to use for this).
BMRMen = 66 + (13.7 * weightPounds/2.2) + (5 * heightInches*2.54) - (6.8 * age)
BMRWomen = 655 + (9.6 * weightPounds/2.2) + (1.8 * heightInches*2.54) - (4.7 *
age)
FoodCalories.txt
1000 ISLAND, SALAD DRSNG,LOCAL*1 TBSP*25
1000 ISLAND, SALAD DRSNG,REGLR*1 TBSP*60
100% NATURAL CEREAL *1 OZ*135
40% BRAN FLAKES, KELLOGG'S*1 OZ*90
40% BRAN FLAKES, POST*1 OZ*90
ALFALFA SEEDS, SPROUTED, RAW*1 CUP*10
ALL-BRAN CEREAL*1 OZ*70
ALMONDS, WHOLE*1 OZ*165
ANGELFOOD CAKE, FROM MIX*1 PIECE*125
APPLE JUICE, CANNED*1 CUP*115
APPLE PIE*1 PIECE*405
APPLESAUCE, CANNED, SWEETENED*1 CUP*195
APPLESAUCE, CANNED,UNSWEETENED*1 CUP*105
APPLES, DRIED, SULFURED*10 RINGS*155
APPLES, RAW, PEELED, SLICED*1 CUP*65
APPLES, RAW, UNPEELED,2 PER LB*1 APPLE*125
APPLES, RAW, UNPEELED,3 PER LB*1 APPLE*80
APRICOT NECTAR, NO ADDED VIT C*1 CUP*140
APRICOTS, CANNED, JUICE PACK*1 CUP*120
APRICOTS, CANNED, JUICE PACK* 3 HALVES*40
APRICOTS, DRIED, COOKED,UNSWTN*1 CUP*210
APRICOTS, DRIED, UNCOOKED*1 CUP*310
APRICOTS, RAW*3 APRCOT*50
APRICOT, CANNED, HEAVY SYRUP* 1 CUP*215
APRICOT, CANNED, HEAVY SYRUP* 3 HALVES*70
ARTICHOKES, GLOBE, COOKED, DRN*1 ARTCHK*55
ASPARAGUS, CKD FRM FRZ,DRN,CUT*1 CUP*50
ASPARAGUS, CKD FRM FRZ,DR,SPER*4 SPEARS*15
ASPARAGUS, CKD FRM RAW, DR,CUT*1 CUP*45
ASPARAGUS, CKD FRM RAW,DR,SPER*4 SPEARS*15
ASPARAGUS,CANNED,SPEARS,NOSALT*4 SPEARS*10
ASPARAGUS,CANNED,SPEARS,W/SALT*4 SPEARS*10
AVOCADOS, CALIFORNIA*1 AVOCDO*305
AVOCADOS, FLORIDA*1 AVOCDO*340
BAGELS, EGG*1 BAGEL*200
BAGELS, PLAIN*1 BAGEL*200
BAKING POWDER, LOW SODIUM*1 TSP*5
BAKING POWDER, STRGHT PHOSPHAT*1 TSP*5
BAKING POWDER,SAS, CA PO4*1 TSP*5
BAKING POWDER,SAS,CAPO4+CASO4*1 TSP*5
BAKING PWDR BISCUITS,FROM MIX *1 BISCUT*95
BAKING PWDR BISCUITS,HOMERECPE*1 BISCUT*100
BAKING PWDR BISCUITS,REFRGDOGH*1 BISCUT*65
BAMBOO SHOOTS, CANNED, DRAINED*1 CUP*25
BANANAS*1 BANANA*105
BANANAS, SLICED*1 CUP*140
BARBECUE SAUCE*1 TBSP*10
BARLEY, PEARLED,LIGHT, UNCOOKD*1 CUP*700
BEAN SPROUTS, MUNG, COOKD,DRAN*1 CUP*25
BEAN SPROUTS, MUNG, RAW*1 CUP*30
BEAN WITH BACON SOUP, CANNED*1 CUP*170
BEANS,DRY,CANNED,W/FRANKFURTER*1 CUP*365
BEANS,DRY,CANNED,W/PORK+SWTSCE*1 CUP*385
BEANS,DRY,CANNED,W/PORK+TOMSCE*1 CUP*310
BEEF AND VEGETABLE STEW,HM RCP*1 CUP*220
BEEF BROTH, BOULLN, CONSM,CNND*1 CUP*15
BEEF GRAVY, CANNED*1 CUP*125
BEEF HEART, BRAISED*3 OZ*150
BEEF LIVER, FRIED*3 OZ*185
BEEF NOODLE SOUP, CANNED*1 CUP*85
BEEF POTPIE, HOME RECIPE*1 PIECE*515
BEEF ROAST, EYE O RND, LEAN*2.6 OZ*135
BEEF ROAST, EYE O RND,LEAN+FAT*3 OZ*205
BEEF ROAST, RIB, LEAN ONLY*2.2 OZ*150
BEEF ROAST, RIB, LEAN + FAT*3 OZ*315
BEEF STEAK,SIRLOIN,BROIL,LEAN *2.5 OZ*150
BEEF STEAK,SIRLOIN,BROIL,LN+FT*3 OZ*240
BEEF, CANNED, CORNED*3 OZ*185
BEEF, CKD,BTTM ROUND,LEAN ONLY*2.8 OZ*175
BEEF, CKD,BTTM ROUND,LEAN+ FAT*3 OZ*220
BEEF, CKD,CHUCK BLADE,LEANONLY*2.2 OZ*170
BEEF, CKD,CHUCK BLADE,LEAN+FAT*3 OZ*325
BEEF, DRIED, CHIPPED*2.5 OZ*145*
BEER, LIGHT*12 FL OZ*95
BEER, REGULAR*12 FL OZ*150
BEET GREENS, COOKED, DRAINED*1 CUP*40
BEETS, CANNED, DRAINED,NO SALT*1 CUP*55
BEETS, CANNED, DRAINED,W/ SALT*1 CUP*55
BEETS, COOKED, DRAINED, DICED*1 CUP*55
BEETS, COOKED, DRAINED, WHOLE* 2 BEETS*30
BLACK-EYED PEAS, DRY, COOKED*1 CUP*190
BLACK BEANS, DRY, COOKED,DRAND*1 CUP*225
BLACKBERRIES, RAW*1 CUP*75
BLACKEYE PEAS, IMMATR,RAW,CKED*1 CUP*180
BLACKEYE PEAS,IMMTR,FRZN,CKED*1 CUP*225
BLUE CHEESE*1 OZ*100
BLUE CHEESE SALAD DRESSING*1 TBSP*75
BLUEBERRIES, FROZEN, SWEETENED*1 CUP*185
BLUEBERRIES, FROZEN, SWEETENED*10 OZ*230
BLUEBERRIES, RAW*1 CUP*80
BLUEBERRY MUFFINS, HOME RECIPE*1 MUFFIN*135
BLUEBERRY MUFFINS,FROM COM MIX*1 MUFFIN*140
BLUEBERRY PIE*1 PIECE*380
BOLOGNA*2 SLICES*180
BOSTON BROWN BREAD,W/WHTECRNM*1 SLICE*95
BOSTON BROWN BREAD,W/YLLWCRNML*1 SLICE*95
BOUILLON, DEHYDRTD, UNPREPARED*1 PKT*15
BRAN MUFFINS, FROM COMMERL MIX*1 MUFFIN*140
BRAN MUFFINS, HOME RECIPE*1 MUFFIN*125
BRAUNSCHWEIGER*2 SLICES*205
BRAZIL NUTS*1 OZ*185
BREAD STUFFING,FROM MX,DRYTYPE*1 CUP*500
BREAD STUFFING,FROM MX,MOIST*1 CUP*420
BREADCRUMBS, DRY, GRATED*1 CUP*390
BROCCOLI, FRZN, COOKED, DRANED*1 CUP*50
BROCCOLI, FRZN, COOKED, DRANED*1 PIECE*10
BROCCOLI, RAW*1 SPEAR*40
BROCCOLI, RAW, COOKED, DRAINED*1 CUP*45
BROCCOLI, RAW, COOKED, DRAINED*1 SPEAR*50
BROWN AND SERVE SAUSAGE,BRWND*1 LINK*50
BROWN GRAVY FROM DRY MIX*1 CUP*80
BROWNIES W/ NUTS,FRM HOME RECP*1 BROWNE*95
BROWNIES W/ NUTS,FRSTNG,CMMRCL*1 BROWNE*100
BRUSSELS SPROUTS, FRZN, COOKED*1 CUP*65
BRUSSELS SPROUTS, RAW, COOKED*1 CUP*60
BUCKWHEAT FLOUR, LIGHT, SIFTED*1 CUP*340
BULGUR, UNCOOKED*1 CUP*600
BUTTERMILK, DRIED*1 CUP*465
BUTTERMILK, FLUID*1 CUP*100
BUTTER, SALTED*1 PAT*35
BUTTER, SALTED*1 TBSP*100
BUTTER, SALTED*1/2 CUP*810
BUTTER, UNSALTED*1 PAT*35
BUTTER, UNSALTED*1 TBSP*100
BUTTER, UNSALTED*1/2 CUP*810
CABBAGE, CHINESE, PAK-CHOI,CKD*1 CUP*20
CABBAGE, CHINESE,PE-TSAI, RAW*1 CUP*10
CABBAGE, COMMON, COOKED, DRNED*1 CUP*30
CABBAGE, COMMON, RAW*1 CUP*15
CABBAGE, RED, RAW*1 CUP*20
CABBAGE, SAVOY, RAW*1 CUP*20
CAKE OR PASTRY FLOUR, SIFTED*1 CUP*350
CAMEMBERT CHEESE*1 WEDGE*115
CANTALOUP, RAW*1/2 MELN*95
CAP'N CRUNCH CEREAL*1 OZ*120
CARAMELS, PLAIN OR CHOCOLATE*1 OZ*115
CAROB FLOUR*1 CUP*255
CARROT CAKE,CREMCHESE FRST,REC*1 PIECE*385
CARROTS, CANNED, DRN, W/ SALT*1 CUP*35
CARROTS, CANNED,DRND, W/O SALT*1 CUP* 35
CARROTS, COOKED FROM FROZEN*1 CUP*55
CARROTS, COOKED FROM RAW*1 CUP*70
CARROTS, RAW, GRATED*1 CUP*45
CARROTS, RAW, WHOLE*1 CARROT*30
CASHEW NUTS, DRY ROASTD,SALTED*1 OZ*165
CASHEW NUTS, DRY ROASTD,UNSALT*1 CUP*785
CASHEW NUTS, DRY ROASTD,UNSALT*1 OZ*165
CASHEW NUTS, DRY ROASTED,SALTD*1 CUP*785
CASHEW NUTS, OIL ROASTD,SALTED*1 CUP* 750
CASHEW NUTS, OIL ROASTD,SALTED*1 OZ*165
CASHEW NUTS, OIL ROASTD,UNSALT*1 CUP*750
CASHEW NUTS, OIL ROASTD,UNSALT*1 OZ*165
CATSUP*1 CUP*290
CATSUP*1 TBSP*15
CAULIFLOWER, COOKED FROM FROZN*1 CUP*35
CAULIFLOWER, COOKED FROM RAW*1 CUP*30
CAULIFLOWER, RAW*1 CUP*25
CELERY SEED*1 TSP*10
CELERY, PASCAL TYPE, RAW,PIECE*1 CUP*20
CELERY, PASCAL TYPE, RAW,STALK*1 STALK*5
CHEDDAR CHEESE*1 CU IN*70
CHEDDAR CHEESE*1 OZ*115
CHEDDDAR CHEESE, SHREDDED*1 CUP*455
CHEERIOS CEREAL*1 OZ*110
CHEESE CRACKERS, SANDWCH,PEANT*1 SANDWH *40
CHEESE SAUCE W/ MILK, FRM MIX *1 CUP*305
CHEESEBURGER, 4OZ PATTY*1 SANDWH*525
CHEESEBURGER, REGULAR*1 SANDWH*300
CHEESECAKE*1 PIECE*280
CHERRIES, SOUR,RED,CANND,WATER*1 CUP*90
CHERRIES, SWEET, RAW*10 CHERRY*50
CHERRY PIE*1 PIECE*410
CHESTNUTS, EUROPEAN, ROASTED*1 CUP*350
CHICKEN A LA KING, HOME RECIPE*1 CUP*470
CHICKEN AND NOODLES, HOME RECP*1 CUP*365
CHICKEN CHOW MEIN, CANNED*1 CUP*95
CHICKEN CHOW MEIN, HOME RECIPE*1 CUP*255
CHICKEN FRANKFURTER*1 FRANK*115
CHICKEN GRAVY FROM DRY MIX*1 CUP*85
CHICKEN GRAVY, CANNED*1 CUP*190
CHICKEN LIVER, COOKED*1 LIVER*30
CHICKEN NOODLE SOUP, CANNED*1 CUP*75
CHICKEN NOODLE SOUP,DEHYD,PRPD*1 PKT*40
CHICKEN POTPIE, HOME RECIPE*1 PIECE* 545
CHICKEN RICE SOUP, CANNED*1 CUP*60
CHICKEN ROLL, LIGHT*2 SLICES*90
CHICKEN, CANNED, BONELESS*5 OZ*235
CHICKEN, FRIED, BATTER, BREAST*4.9 OZ*365
CHICKEN, FRIED, BATTER,DRMSTCK*2.5 OZ*195
CHICKEN, FRIED, FLOUR, BREAST*3.5 OZ*220
CHICKEN, FRIED, FLOUR, DRMSTCK*1.7 OZ*120
CHICKEN, ROASTED, BREAST*3.0 OZ*140
CHICKEN, ROASTED, DRUMSTICK*1.6 OZ*75
CHICKPEAS, COOKED, DRAINED*1 CUP*270
CHILI CON CARNE W/ BEANS, CNND*1 CUP*340
CHILI POWDER*1 TSP*10
CHOCOLATE CHIP COOKIES,COMMRCL*4 COOKIE*180
CHOCOLATE CHIP COOKIES,HME RCP*4 COOKIE*185
CHOCOLATE CHIP COOKIES,REFRIG*4 COOKIE*225
CHOCOLATE MILK, LOWFAT 1%*1 CUP*160
CHOCOLATE MILK, LOWFAT 2%*1 CUP*180
Program GUI