Created
March 9, 2023 21:56
-
-
Save mtahiriqbaldeveloper/3697f384ebd0b8c9b5ec989c2780245d to your computer and use it in GitHub Desktop.
NutritionFacts telescoping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public NutritionFacts{ | |
private int servingSize; //required | |
private int servings; //required | |
//optional parameters initialized to default values | |
private int calories; // optional | |
private int fat; //optional | |
private int sodium; //optional | |
private int carbohydrates; //optional | |
public NutritionFacts(int servingSize, int servings){ | |
servingSize = servingSize; | |
servings = servings; | |
} | |
public NutritionFacts(int servingSize, int servings, int calories, fat){ | |
servingSize = servingSize; | |
servings = servings; | |
calories = calories; | |
fat = fat; | |
} | |
public NutritionFacts(int servingSize, int servings, int calories){ | |
servingSize = servingSize; | |
servings = servings; | |
calories = calories; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment