Question

In: Computer Science

Create JAVA PROGRAM, and write comment for codes also. 2) Every extra 3500 calories means gaining...

Create JAVA PROGRAM, and write comment for codes also.

2) Every extra 3500 calories means gaining a pound. Falling short by 3500 means losing a pound. Get the base amount of calories the person needs in a day (BMR). Then have the user enter in calorie totals for each day and display their weight every week. They might eat more than once in a day.

Solutions

Expert Solution

import java.util.*;

class BMI
{
   public static void main(String args[])
   {
       int calories[] = new int[10];
       int basic_calories;
       Scanner sc = new Scanner(System.in);
       System.out.println("enter minimum calories required per day:");
       basic_calories = sc.nextInt();
       int sum = 0;
       for(int i = 0;i <7;i++)
       {
           System.out.println("enter the calories per day:\t");
           calories[i] = sc.nextInt();
           sum += calories[i];
       }
       int gain = 0, loss = 0;
       if(sum > 3500)
       {
           gain = gain + (int)(sum/3500);
           System.out.println("The weight gain is "+ gain +"pounds\n");
       }
       else
       {
           loss = loss + (int)(3500/sum);
           System.out.println("The weight loss is "+ loss +"pounds\n");
       }
      

      
   }
}

If you have any doubts please comment and please don't dislike.


Related Solutions

Create JAVA PROGRAM, and write comment for codes also. 3) You want to keep track of...
Create JAVA PROGRAM, and write comment for codes also. 3) You want to keep track of your progress towards running a 10K. There are two kinds of races - 5K and 10K. The program needs to ask what race was run and what the time was in seconds until the user quits. When they quit, display the average and best time for each type of race in minutes.
Create JAVA PROGRAM, and write comment for codes also. 4) Prompt the user for how much...
Create JAVA PROGRAM, and write comment for codes also. 4) Prompt the user for how much stuff a truck can carry, in pounds. Then ask them for the weight of each thing they add until they stop. Don't forget to be safe.
Create JAVA PROGRAM, and write comment for codes also. 1) Let the user enter in candidate...
Create JAVA PROGRAM, and write comment for codes also. 1) Let the user enter in candidate names for a ballot. Then imagine the program is moved to a voting booth. Each voter enters their unique name and who they vote for, and when there are no more voters display who won. (Imagine something outside your program is telling it there are no more voters.)
Create a C program that performs the following (please comment the codes): a) Create a Stack...
Create a C program that performs the following (please comment the codes): a) Create a Stack ADT. Stack should be implemented using the linked list. b) Enter 10 random integer numbers between 0 to 50 in the stack. c) After pushing each element, print the content of the top of the stack. c) Then pop out those 10 integer numbers and print those numbers. d) Finally destroy the Stack.
Part 2: BasalMetabolicRate Write a Java program that estimates the number of calories your body needs...
Part 2: BasalMetabolicRate Write a Java program that estimates the number of calories your body needs to maintain your weight if you do no exercise. This is called your BMR (or Basal Metabolic Rate) and can be calculated with the Harris-Benedict equation. The calories needed for a woman to maintain her weight is: BMR (calories) = 655 + (4.35 * weight in pounds) + (4.7 * height in inches) - (4.7 * age in years) The calories needed for a...
Write this code in java and don't forget to comment every step. Write a method which...
Write this code in java and don't forget to comment every step. Write a method which asks a baker how hot their water is, and prints out whether it is OK to make bread with the water. If the water is at or above 110F, your method should print "Too Warm." If the water is below 90.5F, print "Too Cold." If it is in between, print "Just right to bake!" For example, if the user inputs the number 100.5, the...
Write a complete JAVA program, including comments (worth 2 pts -- include a good comment at...
Write a complete JAVA program, including comments (worth 2 pts -- include a good comment at the top and at least one more good comment later in the program), to process data for the registrar as follows: NOTE: Include prompts. Send all output to the screen. 1. Read in the id number of a student, the number of credits the student has, and the student’s grade point average (this is a number like 3.25). Print the original data right after...
Write the following program in java please. a. Include a good comment when you write the...
Write the following program in java please. a. Include a good comment when you write the method described below: Method method1 receives an integer, n, and a real number, d, and returns a real number. If the integer is positive it returns the square root of the real number added to the integer. If the integer is negative or zero it returns the absolute value of the integer multiplied by the real number. b. Write the statements from the main...
write code in java and comment. thanks. the program is about interface . Implement the basics...
write code in java and comment. thanks. the program is about interface . Implement the basics of Fitness and types of Fitness: Aerobic. Implement specific Fitness types such as Swimming, Cycling, Fitness Task: public interface Fitness (10pts) This will be used as a starting point for deriving any specific Fitness type. Every fitness exercise type has one or more muscle group it affects. Therefor a Fitness has the following abstarct method (Note that all methods in an interface are abstract...
Please use Java language! with as much as comment! thanks! Write a program that displays a...
Please use Java language! with as much as comment! thanks! Write a program that displays a frame with a three labels and three textfields. The labels should be "width:", "height:", and "title:" and should each be followed by one textfield. The texfields should be initialized with default values (Example 400, 600, default title), but should be edited by the user. There should be a button (label it whatever you want, I don't care). If you click the button, a new...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT