Create program which asks for number of fat grams

Assignment Help Programming Languages
Reference no: EM1370069

Design a program that asks for the number of fat grams and calories in a food item. Validate the input as follows:

- Make sure the number of fat grams and calories are not less than 0.

- According to nutritional formulas, the number of calories cannot exceed fat grams X 9. Make sure that the number of calories entered is not greater than fat grams x 9.

Once correct data has been entered, the program should calculate and display the percentage of calories that come from fat. Use the following formula:

Percentage of calories from fat = (fat grams x 9) / calories

Some nutritionists classify a food as "low fat" if less than 30 percent of its calories come from fat. If the results of this forumlas are less than 0.3, the program should display a message indicating the food is low in fat.

Reference no: EM1370069

Questions Cloud

Compute the related total revenue and marginal revenue : Evaluate the price and the output information in the following table. Calculate the related total revenue and marginal revenue.
Explain and develop a research report of product : Explain and develop a research report of product in accepted business style and professional recommendation as to whether or not the agency's sales team should pursue a client that sells this product.
How has nature view succeeded in the natural foods channel : How has Nature View succeeded in the natural foods channel and what are the two primary types of growth strategies under consideration by Nature View?
Describing weighted average cost of capital : Compute the weighted average cost of capital using book value weights. Compute the weighted average cost of capital using market value weights. Compare the answers obtained in parts a and b. Describe the differences.
Create program which asks for number of fat grams : Create a program which asks for number of fat grams and calories in a food item. Validate input as follows: Make sure number of fat grams and calories are not less than 0.
Show the personal reflection of environmental concerns : How big an issue is this for us, how much (if any) is business responsible for it and how much change (if any) is needed to get us on the right track
Competing in rapid-growth industries : Competing in rapid-growth industries - suitable strategy option for companies competing in rapid-growth industries?
Determining minimum variable costs of cost function : At what output is AVC at minimum? If the market price of firm's output is $7 per unit, should the firm produce or shut down?
Decisions in competitive markets : The MidNight Hour, a local nightclub, earned $100,000 in accounting profit past year. This year the owner, who had invested $1 million in club, decided to close club.

Reviews

Write a Review

Programming Languages Questions & Answers

  Define function that takes year as it-s input argument

Define and call a function fast_food_billions that takes the year as it's input argument and returns the prediction as it's result. Tell the user that entry of a year before 2005 will cause the program to stop.

  General layout for a web-based source document

Suggest the general layout for web-based source document that prospective sellers could use to explain their antiques. Information must include the user ID, password, item, dimensions, origin, condition, and asking price.

  Program to use next character to create and return operator

Convert the string of digits into an integer. Otherwise, use the next character to create and return an operator.

  Provide example of array and how it could be used

Provide the example of the Array and how it could be used. Then look over sections on ArrayLists. Would an ArrayList be better suited for your use?

  Write and implement generic set class with attributes

Write and implement the generic Set class with attributes you find essential and with the following methods. Set class has nonduplicate elements.

  Design a class-based solution to a problem

To design a class-based solution to a problem using multiple data structures.

  Explain multiprogrammed system available in user mode

CPU voltage and frequency or put it to sleep altogether. In a multiprogrammed system should this functionality be available in user mode or only accessible via system call. why or why not?

  Create mock level design for game

Write a 5-page "mock level design" in which you design a level for a game. The game is a shooter, the level is an old warehouse filled with zombies and demons with a boss at the end.

  Sketch program flowchart for program to compute average

Sketch a program flowchart for a program that will compute the average of five grades. Input five grades and output the aveage.

  Write a program that inputs number of hours worked

Write a program that inputs the number of hours worked and hoursly pay rat for employesand outputs their total pay.

  Write program to compute the volume flow rate

Write program to compute volume flow rate in cubic feet per second of water flowing through pipe of diameter d in inches and a velocity of v feet per second.

  Write application which calculates factorials

Write the application which computes the factorials of 1 through 20. use type long. Display results in tabular format. What difficulty might prevent you from calculating factorial of 100?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd