I need help to write a program in Java.
If a moderately active person cuts their calorie intake by 500 calories a day, they can typically lose about 4 pounds a month. Write a program that lets the user enter their starting weight, then creates and displays a table showing what their expected weight will be at the end of each month for the next 6 months if they stay on this diet.
import java.util.*;
class Dieting
{
public static void main (String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("Enter the starting weight of the
person in pounds : ");
double weight = input.nextDouble();
for(int i=1;i<=6;i++)
{
weight = weight -4;
System.out.println("Weight of
person after "+i+" month : "+weight+" pounds");
}
}
}
Output:
Enter the starting weight of the person in pounds : 235 Weight of person after 1 month : 231.0 pounds Weight of person after 2 month : 227.0 pounds Weight of person after 3 month : 223.0 pounds Weight of person after 4 month : 219.0 pounds Weight of person after 5 month : 215.0 pounds Weight of person after 6 month : 211.0 pounds
Do ask if any doubt. Please upvote.
I need help to write a program in Java. If a moderately active person cuts their...
in 80X86 assembly language If moderately active persons cut their calorie intake by 500 calories a day, they can typically lose about 4 pounds a month. Write a program that has the users enter their starting weight and then creates and displays a table showing what their expected weight will be at the end of each month for the next 6 months if they stay on this diet. please show code and output
Write them in python IDLE *****
5. Average Rainfall
Write a program that uses nested loops to collect data
and calculate the average rainfall over a period of years. The
program should first ask for the number of years. The outer loop
will iterate once for each year. The inner loop will iterate twelve
times, once for each month. Each iteration of the inner loop will
ask the user for the inches of rainfall for that month. After all
iterations,...
please help i have a test tomm!!
7. In an effort to lose weight, Elizabeth decides to cut her weekly calorie intake which is currently 11500 calories. She cuts 20 calories from her diet in week 1, and then each week after she decides to double the number of calories cut from the previous week a) Write a recursive formula describing Elizabeth's calorie reduction. b) Write an explicit formula describing Elizabeth's calorie reduction. c) How many calories will Elizabeth be...
Please write a Java program that ask the user how many beers he or she expects to consume each day, on average, as well as the average amount of money he or she spends on a single 12-ounce can of beer. Studies have shown that, on average, someone who consumes a single 12-ounce can of beer every day without compensating for the calorie intake through diet modifications or extra exercise, will gain approximately 15 pounds in one year. You can...
Following is my java program that i need help with. Write a program that uses a JavaFX GUI that allows a user to enter a directory (folder) and then displays the number of the files in the directory. The number of files in the directory should be determined recursively.
Write a Java program and Flowchart that lets the user enter the loan amount and loan period in number of years and displays the monthly and total payments for each interest rate starting from 5% to 10%, with an increment of 1/4. ????ℎ????????? = ?????????? × ????ℎ?????????????? / 1 − 1 (1 + ????ℎ??????????????) ????????????? ×12 ????????????? = ????ℎ????????? × ????????????? × 12
Write a Java application program to generate a calendar for the year 2019 from January to December. Give users the option to display 1 month, 3 months, or 12 months at a time. For 1 month - The user will need to be able to type what month they want to display For 3 months - The user will need to be able to type in the starting month For 12 months - All months will need to be visible...
Write a basic C++ program that will calculate a subject’s basal metabolic rate and estimate how many days it will take to lose a specific number of pounds. The program will perform the following tasks: Declare variables and Named constants. Display “Welcome to <your name>’s Weight Loss Calculator” Prompt the user to enter the subject’s current weight. Prompt the user to enter the subject’s height in feet plus inches. Prompt the user to enter the subject’s age. Prompt the user...
Java
Objective: The goal of this assignment is to practice 2-dimensional ragged arrays. Background: Within a healthy, balanced diet, a grownup needs 2,250 calories a day You will write a program to track calorie intake of a person. Assignment: Calorie intake data from a person is provided in a text file named input.txt. There are arbitrary number of double values on each line, separated by spaces. The numbers represent the number of calories consumed for meals and/or snacks on a...
Write a java program. The cost to join a gym is: 1) Senior citizens: get a 30% discount. 2.) If twelve or more months in advance are bought and paid for, a 15% discount is applied to the membership. The user enters the number of months. 3) Personal Training sessions: 20% discount on each session if more than 12 are bought. This will be a menu-driven, GUI program that determines the cost of a new membership.Using JTextField for input and...