I will Pay you $ 20.00 by Pay pal if u do this program before 4 today. two hrs left.
Problem:
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).
public FoodCaloriesGUI() { super ("Food Calories calculator"); //readTextFile(); //openFileForReading(); readRecordAndDisplay(); String outputArea="name\n"+"Date"+date+"\n"+"Food\t"+"Serving \t"+"Calories\n"+ food+"\t"+serving+"\t"+calories+"\n"+"------------------------------"+"\n"+"Balance\t\t"+balance; JLabel lblName, lblAge, lblWeight,lblHeight,lblFemale,lblMale,lblFood; JTextField txtName, txtAge, txtWeight,txtHeight; JButton btnSave, btnNewUser; ButtonGroup radioGroup; JTextArea dataarea =new JTextArea(outputArea); JRadioButton rbMale,rbFemale; JComboBox cbFood; lblName= new JLabel("Name: "); lblAge= new JLabel("Age: "); lblWeight= new JLabel("Weight(lbs): "); lblHeight= new JLabel("Height(inches): "); lblFemale= new JLabel("Female: "); lblMale= new JLabel("Male: "); lblFood= new JLabel("Choose a Food: ");
txtName= new JTextField(15); txtAge= new JTextField(3); txtWeight= new JTextField(6); txtHeight= new JTextField(6);
cbFood= new JComboBox(); cbFood.setPreferredSize(new Dimension(100, 20));
Container c = getContentPane(); JPanel northPanel = new JPanel(); northPanel.setLayout(new FlowLayout()); btnSave= new JButton("SAVE"); northPanel.add(btnSave);
btnNewUser= new JButton("NEW USER"); northPanel.add(btnNewUser);
//btnSave.addActionListener(this); //btnNewUser.addActionListener(this); JPanel centerPanel = new JPanel(); centerPanel.setLayout(new FlowLayout()); centerPanel.add(lblName);
centerPanel.add(txtName);
centerPanel.add(lblAge);
centerPanel.add(txtAge);
centerPanel.add(lblWeight);
centerPanel.add(txtWeight);
centerPanel.add(lblHeight);
centerPanel.add(txtHeight);
centerPanel.setLayout(new FlowLayout()); rbMale= new JRadioButton("Male",false); rbFemale= new JRadioButton("female",false); radioGroup = new ButtonGroup(); radioGroup.add(rbMale); radioGroup.add(rbFemale); centerPanel.add(rbMale); centerPanel.add(rbFemale); centerPanel.add(lblFood); centerPanel.add(cbFood); JPanel southPanel = new JPanel(); southPanel.setLayout(new FlowLayout()); southPanel.add (dataarea);
What are your first memories of when Nepal Television Began?
पाप न साप घोप्टो पारि थाप !!
पुलिसनी संग - आज शनिवार - अन्तिम भाग
निगुरो थाहा छ ??
ChatSansar.com Naya Nepal Chat
TPS Re-registration case still pending ..
Lets play Antakshari...........
What Happened to Dual Citizenship Bill
Basnet or Basnyat ??
Sajha has turned into MAGATs nest
NRN card pros and cons?
is Rato Bangala school cheating?
मेरो अम्रिका यात्रा -२
Do nepalese really need TPS?
कता जादै छ नेपाली समाज ??
susta manasthiti lai ke bhanchan english ma?
कृष्ण नै अन्तिम सत्य
Nas and The Bokas: Coming to a Night Club near you
राजदरबार हत्या काण्ड बारे....
Mr. Dipak Gyawali-ji Talk is Cheap. US sends $ 200 million to Nepal every year.
Harvard Nepali Students Association Blame Israel for hamas terrorist attacks
TPS Update : Jajarkot earthquake
is Rato Bangala school cheating?
NOTE: The opinions
here represent the opinions of the individual posters, and not of Sajha.com.
It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address
if you want any posting to be considered for deletion. Your request will be
handled on a one to one basis. Sajha.com is a service please don't abuse it.
- Thanks.