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

  Program calculate average number of days employee are absent

Write a program that calculates the average number of days a company's employees are absent. The program should have the following functions: a function called main that asks the user for the number of employees.

  Design program to enter a series of numbers

Design a program that asks the user to enter a series of 20 numbers. The program should determine whether the number is valid by comparing it to the following list of valid charge account numbers.

  Write assignment statement with one arithmetic operator

Write a simple assignment statement with one arithmetic operator in some language you know. For each component of the statement.

  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.

  Machine language used by sim virtual computer simulator

Write a program in machine language used by the SIM virtual computer simulator package to calculate the sum of the four numbers stored in memory addresses A1, A2, A3 and A4.

  Program to output circle-s radius-diameter-circumference

Write a program to prompt the user to enter center and a point on circle. Program must then output circle's radius, diameter, circumference, and area.

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Write a class to accepts no parameters and returns no value

Write class named ParkingMeter containing:A method named tick that accepts no parameters and returns no value. tick decreases value of timeLeft by 1, but only if value of timeLeft is greater than 0.

  Create project to compute checking account balance

Create a project to compute your checking account balance. Form: Include radio buttons to indicate the type of transaction: deposit, check, or service charge.

  Explaining law of diminishing returns

As computer word size gets larger and larger, there is a law of diminishing returns; speed of execution of application programs doesn't increase and may, in fact, decrease.

  Develope a tutoring software for an elementary school

You are the project manger for a company that is planning to develope a tutoring software for an elementary school that will follow their curriculum create a work breadown structure.

  Design logic for application for company-breakdown-payroll

Design the logic for an application for a company that wants a report containing a breakdown of payroll by department.

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