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.)
Write a JAVA program in eclipse (write comment in every line) that asks the user to...
Write a JAVA program in eclipse (write comment in every line) that asks the user to enter two numbers and an operator (+, -, *, / or %), obtain them from the user and prints their sum, product, difference, quotient or remainder depending on the operator. You need to use OOP techniques (objects, classes, methods….). This program must be place in a loop that runs 3 times.
Write in JAVA eclipse program (comment in every line): class for calculating an area of a...
Write in JAVA eclipse program (comment in every line): class for calculating an area of a room. The program MUST ask for the length and the width of the room. Make sure you write the methods to get the width and length and print the area.
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...
Create a C++ or Java program codes for Login Attendance applying the queue principle that will...
Create a C++ or Java program codes for Login Attendance applying the queue principle that will select students from the last attendance login to answer a question. NOTE: Program execution should include deletion and insertion of attendance information/element
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT