Closed zafienas closed 4 years ago
//Developer : Muhammad Shazmi Bin Mohd Basri
//Task : Calculate the fat, calories and calories's from fat percentage
public class Calories {
public static void main (String [] args) {
double fat_gram = 10;
double total_calories = 100;
double calories = 0;
double percentage = 0.0;
String msg = "The food is low on fat";
System.out.println("Fat gram =" +fat_gram);
System.out.println("Total calories =" +total_calories);
calories = fat_gram * 9;
percentage = (calories / total_calories) * 100;
System.out.println("The percentage of calories from fat =" + percentage);
if (percentage < 30)
System.out.println(msg);
else
System.out.println("The food is high on fat");
}
}
//Developer: Elya Maisarah (202487)
//Display the percentage of the calories that come from the fat.
public class Calories {
public static void main (String [] args){
double calories, fat_gram, total_calories, percentage;
fat_gram = 3.2;
total_calories = 100.0;
String message = " The food is low in fat ";
System.out.println(" Fat Grams = " + fat_gram);
System.out.println(" Total calories = " + total_calories);
calories = fat_gram * 9;
percentage = (calories / total_calories) * 100;
System.out.println(" The percentage of the calories from fat = " + percentage);
if (percentage < 30)
System.out.println(message);
else
System.out.println(" The food is high in fat ");
}
}
//Developer : Siti Nurfatihah bt Rozaidi
//Task : Calculate the fat, calories and percentage of calories from fat
public class LabQuestionCalories {
public static void main (String [] args){
double fat_grams = 10.0;
double total_calories = 100;
double calories;
double percentage;
String msg = " The food is low in fat" ;
System.out.println(" Fat grams = " + fat_grams);
System.out.println(" Total calories = " + total_calories);
calories = fat_grams * 9;
percentage = (calories / total_calories) * 100 ;
System.out.println( " The percentage of calories from fat = " + percentage);
if (percentage < 30)
System.out.println(msg);
else
System.out.println(" The food is high in fat");
}
}
//Developer: Farhana Zulkhairi
//Task: Calculate the number of calories
public class Calories {
public static void main (String [] args){
double fat_gram = 3;
double total_calories = 100;
double calories;
double percentage;
String msg = "The food is low in fat";
System.out.println("Fat Grams = " + fat_gram);
System.out.println("Total Calories = " + total_calories);
calories =fat_gram * 9;
percentage = (calories / total_calories) * 100;
System.out.println("The percentage of Calories from fat = " + percentage);
if (percentage < 30)
System.out.println(msg);
}
}
// Developer : Masturah Binti Mokhtar
// Task : Percentage of Calories
public class Calories {
public static void main(String[] args) {
double fat_gram = 3.25;
double total_calories = 90;
double calories = fat_gram * 9;
double percentage = (calories / total_calories) * 100;
System.out.println( " fat_gram = " +3.25);
System.out.println( " total_calories = " +90);
System.out.println( "calories_from_fat = " + calories);
String msg = " The food is high in fat";
System.out.println( " percentage of calories in fat = " + percentage );
if (percentage > 30)
System.out.println(msg);
else
System.out.println(" The food is low in fat ");
}
}
//Diveloper: Noor Husna
//Task: indicating the food is low in fat.
public class activities4 {
public static void main (String [] args){
double fat_grams= 5;
double total_calories= 150;
double calories= 0.0;
double percentage;
String msg = "The food is low in fat";
System.out.println("fat grams=" +fat_grams);
System.out.println("Total Calories =" + total_calories);
calories = fat_grams * 9 ;
percentage = (calories/total_calories) *100;
System.out.println("Calories form food =" + calories);
System.out.println("The percentage of from fat=" +percentage);
if (percentage < 30);
System.out.println(msg);
}
}
//developer = Nurul haswani Bt Ariffin
//Task: Calculate fat and calories
public class calories {
public static void main (String [] args)
{
double fat_gram = 10;
double total_calories = 100;
double calories = 0;
double percentage = 0;
String msg = "The food is low in fat";
System.out.println("Fat Grams = " + fat_gram);
System.out.println("Total Calories = " +total_calories);
calories = fat_gram * 9;
percentage =(calories / total_calories) * 100;
System.out.println("The percentage of calories from fat = " + percentage);
if (percentage < 30)
System.out.println(msg);
else
System.out.println("The food is high on fat");
}
}
//Developer: Nur Fakhira Adriana
// Task : To display the percentage of calories from fat
public class Calories {
public static void main ( String [] args ) {
double fat_grams = 2.8 ;
double total_calories = 100.0 ;
double calories ;
double percentage ;
String msg = " The food is in low fat ";
calories = fat_grams * 9 ;
percentage = (calories / total_calories) * 100 ;
System.out.println( " Fat grams = " + fat_grams);
System.out.println( "Total calories = " + total_calories);
System.out.println("The percentage of calories from fat = " + percentage);
if
(percentage < 30 )
System.out.println(msg);
else
System.out.println("The food is in high fat ");
}
}
// Developer : Farhana Yusri
// Task : Calculate percentage of calories
public class Main {
public static void main (String [] args) {
double fat_grams= 5;
double total_calories= 100;
double calories= 0.0;
double percentage;
String msg = "The food is low in fat";
fat_grams = 5;
total_calories = 100;
String message = " The food is low in fat ";
System.out.println(" Fat Grams = " + fat_grams);
System.out.println(" Total calories = " + total_calories);
calories = fat_grams * 9;
percentage = (calories / total_calories) * 100;
System.out.println(" The percentage of the calories from fat = " + percentage);
if (percentage < 30)
System.out.println(msg);
else
System.out.println(" The food is high in fat ");
}
}
//Developer: Nadiah Ismail
//Task: Calculate percentage of calories from fat
public class Calories {
public static void main(String[] args)
{
double fat_gram = 3;
double total_calories = 100;
double calories;
double percentage;
String msg = "The food is low in fat";
System.out.println("Fat grams = " + fat_gram);
System.out.println("Total calories = " + total_calories);
calories = fat_gram * 9;
percentage = (calories / total_calories) * 100;
System.out.println("The percentage of calories from fat = " + percentage);
if(percentage < 30)
System.out.println(msg);
}
}
// Developer: Wan Nurfarah Binti Wan Zulkifli
// Task: Percentage of Calories
public class Calories {
public static void main (String [] args) {
double fat_grams = 2;
double total_calories = 100;
double calories = 0;
double percentage = 0.0;
String msg = "The food is low in fat";
System.out.println("Fat Grams = " + fat_grams);
System.out.println("Total Calories = " + total_calories);
calories = fat_grams* 9;
percentage = (calories / total_calories) * 100;
System.out.println("The Percentage of Calories From Fat = " + percentage);
if (percentage < 30)
System.out.println(msg);
}
}
//Developer : Danish
//Task : Calculate Percentage of Calories
public class Main {
public static void main(String[] args) {
double fat_gram = 2.5;
double total_calories = 90;
double calories = fat_gram * 9;
double percentage = (calories / total_calories) * 100;
System.out.println("fat_gram = " + 2.5);
System.out.println(" total_calories = " + 90);
System.out.println(" calories_from_fat =" + calories);
String msg = " The food is high in fat";
System.out.println(" The percentage of calories in fat =" + percentage );
if (percentage > 30)
System.out.println(msg);
else
System.out.println("The food is low in fat");
}
}
// Developer : Azeelah Yasmin Bt Azlee
//Task : Percentage of calories
public class calories {
public static void main(String [] args) {
double fat_gram = 6;
double total_calories = 100;
double calories;
double percentage;
String msg = "The food is low in fat";
System.out.println(" Fat Gram = "+fat_gram);
System.out.println(" Total Calories = "+total_calories);
calories = fat_gram * 9;
percentage = (calories / total_calories) *100;
System.out.println(" The percentage of calories from fat = " + percentage );
if (percentage < 30)
System.out.print(msg);
else
System.out.println(" The food is high in fat");
}
}
//Developer : Norshasha Sorfina
//Task : Percentage of Calories
public class CaloriesPercentage {
public static void main(String[] args){
double fat_gram = 5;
double total_calories = 100;
double calories;
double percentage;
String msg = " The food is low in fat ";
System.out.println(" Fat Grams = " + fat_gram);
System.out.println(" Total Calories = " + total_calories);
calories = fat_gram * 9;
percentage = (calories / total_calories) * 100;
System.out.println(" The percentage of calories from fat = " + percentage);
if (percentage < 30)
System.out.println(msg);
else
System.out.println(" The food is high in fat");
}
}
//Developer : Hazirah Rosli
//Task : Percentage of the calories
public class Percentage {
public static void main (String [] args) {
double fat_grams = 10 ;
double total_calories = 100;
double calories = 0;
double percentage = 0.0;
String msg = "The food is low in fat";
System.out.println("Fat Grams = " + fat_grams);
System.out.println("Total Calories = " + total_calories);
calories = fat_grams * 9;
percentage = (calories / total_calories) * 100;
System.out.println("The percentage of calories from fat =" + percentage);
if (percentage < 30)
System.out.println(msg);
}
}
//Developer: Nur hanis haziqah binti hisham haizad
//calculate percentage of calories
public class Calories {
public static void main ( String [] args){
double fat_gram = 4;
double total_calories = 150;
double calories;
double calories_percentage;
String msg = " The food is in low fat";
System.out.println(" Fat grams = " +fat_gram);
System.out.println(" Total Calories = " +total_calories);
calories = fat_gram * 9;
System.out.println(" Calories from fat gram = "+ calories);
calories_percentage = (calories/total_calories) * 100;
System.out.println(" Percentage of calories = " + calories_percentage);
if (calories_percentage < 30)
System.out.println(msg);
else
System.out.println(" The food is in high fat");
}
}
//Developer : Siti Nur Syazimah Binti Abu
//Task : Percentage of the Calories
public class Calories {
public static void main (String [] args) {
double fat_gram = 10;
double total_calories = 100;
double calories = 0;
double percentage = 0.0;
String msg = "The food is low in fat";
System.out.println("Fat Grams = " + fat_gram);
System.out.println("Total calories = " + total_calories);
calories = fat_gram * 9;
percentage = calories / total_calories;
System.out.println("The percentage of calories from fat = " + percentage);
if (percentage < 30);
System.out.println(msg);
}
}
//Developer:Lyana Azwanis
//Task:Percentage of calories
public class Activity4 {
public static void main (String [] args){
double fat_grams = 4;
double number_of_calories = 200;
double calories = 0;
double percentage = 0;
String msg = "the food is low in fat";
System.out.println("fat grams =" + fat_grams);
System.out.println("total of calories =" + number_of_calories);
calories = fat_grams * 9;
percentage = calories/ number_of_calories * 100;
System.out.println("calories from fat =" + calories);
System.out.println("the percentage of fat=" + percentage);
if (percentage < 30);
System.out.println(msg);
}
}
https://prnt.sc/ve2oai
// Developer: Azim
// Task: Calculate fat and calories
public class Calories {
public static void main (String [] args) {
double fat_gram = 10;
double total_calories = 100;
double calories = 0;
double percentage = 0.0;
String msg = "The food is low on fat";
System.out.println("Fat gram =" +fat_gram);
System.out.println("Total calories =" +total_calories);
calories = fat_gram * 9;
percentage = (calories / total_calories) * 100;
System.out.println("The percentage of calories from fat =" + percentage);
if (percentage < 30)
System.out.println(msg);
else
System.out.println("The food is high in fat");
}
}
//Developer: Abdul Azim (203198)
//Task: Calories
public class calories {
public static void main (String [] args) {
double fat_gram = 3.3;
double total_calories = 100;
double calories = 0;
double percentage = 0.0;
String msg = "This food is low on fat";
System.out.println("Fat gram =" +fat_gram);
System.out.println("Total calories =" +total_calories);
calories = fat_gram * 9;
percentage = (calories / total_calories) * 100;
System.out.println("The percentage of calories from fat =" + percentage);
if (percentage < 30)
System.out.println(msg);
else
System.out.println("The food is high on fat");
}
}
```java
//Developer : Ikmal Hafiq
//Task : Number of Calories
public class calories {
public static void main (String[] args) {
double fatgram = 10;
double totalcalories = 100;
double calories;
double percentage;
String msg = "The food is low in fat";
System.out.println("Fat Grams = "+fatgram);
System.out.println("Total Calories = "+totalcalories);
calories = fatgram * 9;
percentage = (calories / totalcalories) * 100;
System.out.println("The percentage of calories from fat = "+percentage);
if (percentage <30 )
System.out.println(msg);
}
}
// Developer : Izzati Syahzanani
// Task : Calculating Percentage of Calories
public class Calories {
public static void main (String [] args){
double fat_gram = 2;
double total_calories = 100;
double calories = 0;
double percentage = 0.0;
String msg = "The food is low in fat ";
System.out.println("Fat Gram " + fat_gram);
System.out.println("Total Calories " + total_calories);
calories = fat_gram * 9;
percentage = (calories / total_calories) * 100;
System.out.println("The percentage of calories from fat = " + percentage);
if (percentage < 30)
System.out.println(msg);
else (percentage > 30)
System.out.println("The food is high on fat");
}
}
// developer: arif qhuzairie
// task: percentage of calories
public class calori {
public static void main ( String [] args ){
double fat_gram = 100;
double total_calories = 900;
double calories = fat_gram * 9;
double percentage = (calories / total_calories) * 100;
System.out.println(" fat_gram = " + 100);
System.out.println(" total_calories = " + 900);
System.out.println(" calories_from_fat =" + calories);
String msg = " The food is high in fat";
System.out.println(" The percentage of calories in fat =" + percentage );
if (percentage > 30)
System.out.println(msg);
else
System.out.println("The food is low in fat");
}
}
//developer : yazid rahman 204608
public class taskcalories {
public static void main (String [] args) {
double fat_gram = 2;
double total_calories = 200;
double calories = 0;
double percentage = 0.0;
String notice = "The food is low in fat";
System.out.println("Fat gram =" +fat_gram);
System.out.println("Total calories =" +total_calories);
calories = fat_gram * 9;
percentage = (calories / total_calories) * 100;
System.out.println("The percentage of calories from fat =" + percentage);
if (percentage < 30)
System.out.println(notice);
}
}
//Developer : Batrisya Alwani
//Task: calories
public class Main {
public static void main(String[] args) {
double fat_gram = 8;
double total_calories = 80;
double calories = fat_gram * 9;
double percentage = (calories / total_calories) * 100;
System.out.println("fat_gram = " + 8);
System.out.println(" total_calories = " + 80);
System.out.println(" calories_from_fat =" + calories);
String msg = " The food is high in fat";
System.out.println(" The percentage of calories in fat =" + percentage );
if (percentage > 30)
System.out.println(msg);
else
System.out.println("The food is low in fat");
}
}
Problem Definition:
Draw a flowchart and write an algorithm that task the user to enter the numbers of calories and fat grams in a food item. Display the percentage of the calories that come from the fat. One gram fat has 9 calories, therefore:
The percentage of calories from fat can be calculated as follows:
If the calories from fat are less than 30 percent of the calories of the food, it should also display a message indicating the food is low in fat.
Submission: