1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Arisa [49]
3 years ago
13

The manager of Fitness Health Club wants a program that allows her to enter the number of calories and grams of fat contained in

a specific food. The program should calculate and display two values: the food's fat calories and its fat percentage. The fat calories are the number of calories attributed to fat. The fat percentage is the ratio of the food's fat calories to its total calories. You can calculate a food's fat calories by multiplying its fat grams by the number 9, because each gram of fat contains 9 calories. To calculate the fat percentage, you divide the food's fat calories by its total calories and then multiply the result by 100. The fat percentage should be displayed with zero decimal places. The fat calories are the number of calories are integers. You must use static_cast and setprecision.
Computers and Technology
1 answer:
liberstina [14]3 years ago
3 0

Answer:

Explanation:

Below is the code used to carry out this problem, i hope you try it out and apply it to other similar problems.

Code to Copy:

Public Class myFatCalculator

'calculating fat

Private Sub btnCalculateFat_Click(sender As Object, e As EventArgs) Handles btnCalculateFat.Click

    Dim totCalories As Integer

    Dim grams As Decimal

    Dim fatCalories As Decimal

    Dim fatPercentage As Decimal

   

    Integer.TryParse(txtTotCalories.Text,totCalories)

    Decimal.TryParse(txtGrams.Text, grams);

    fatCalories=grams*9

    fatPercentage=fatCalories/totCalories*100;

    lblFatCalories.Text=fatCalories.ToString()

    lblFatPercentage.Text=fatPercentage.ToString("N0")

End Sub

'Clear all text boxes & labels

Private Sub btnClearForm_Click(sender As Object, e As EventArgs)Handles btnClearFrom_Click

    txtTotCalories.Clear()

    txtTotCalories.Clear()

    lblFatCalories.Clear()

    lblFatPercentage.Clear() ‘clear labels

End Sub

'Exit from the Application

Private Sub btnExitApp_Click(sender As Object, e As EventArgs)Handles btnExitApp_Click

    Application.Exit()

End Sub

'class ends

End Class

Coding:

Public Class myFatCalculator

'calculating fat

Private Sub btnCalculateFat_Click(sender As Object, e As EventArgs) Handles btnCalculateFat.Click

    Dim totCalories As Integer

    Dim grams As Decimal

    Dim fatCalories As Decimal

    Dim fatPercentage As Decimal

   

    Integer.TryParse(txtTotCalories.Text,totCalories)

    Decimal.TryParse(txtGrams.Text, grams);

    fatCalories=grams*9

    fatPercentage=fatCalories/totCalories*100;

    lblFatCalories.Text=fatCalories.ToString()

    lblFatPercentage.Text=fatPercentage.ToString("N0")

End Sub

'Clear all text boxes & labels

Private Sub btnClearForm_Click(sender As Object, e As EventArgs)Handles btnClearFrom_Click

    txtTotCalories.Clear()

    txtTotCalories.Clear()

    lblFatCalories.Clear()

    lblFatPercentage.Clear() ‘clear labels

End Sub

'Exit from the Application

Private Sub btnExitApp_Click(sender As Object, e As EventArgs)Handles btnExitApp_Click

    Application.Exit()

End Sub

'class ends

End Class

cheers i hope this helped !!!!

You might be interested in
Mation about which osi layers of connected cisco devices can be verified with the show cdp neighbors comm
fgiga [73]
The show CDP neighbor command operates at the Data link layer (Layer 2)

Cisco Discovery Protocol (CDP) is a proprietary Data Link Layer protocol developed by Cisco Systems. It is used to share information about other directly connected Cisco equipment, such as the operating system version and IP address.

6 0
3 years ago
When studying an information system, illustrations of actual documents should be collected using a process called _____.
Oliga [24]
<span>When studying an information system, illustrations of actual documents should be collected using a process called sampling. Correct answer: D
</span>This process systematically selects representative elements of a population with the goal to get representative and useful information about the population as a whole and it is useful when <span>data sets that are too large to efficiently analyze in full.</span>
6 0
4 years ago
The mouse and keyboard are also sometimes called
likoan [24]
Hi!

The mouse and the keyboard are <em>input devices. </em>By using them, we can input data which will give us a (hopefully) desired output!

For example...

Just by using my keyboard to type, I'm inputting data in the form of ASCII characters and symbols.

By using my mouse to click on an area so I can move this sentence on a new line, I had to input a request to do such!

Hopefully, this helps! =)
7 0
4 years ago
Click to review the online content. Then answer the question(s) below, using complete sentences. Scroll down to view additional
lbvjy [14]

Answer:  you can say  or talket to them why or how

Explanation:

4 0
3 years ago
Read 2 more answers
What would be some reasons to change the default page<br> encoding?
madam [21]

Answer:

Synchronization with the document for one reason or another

5 0
3 years ago
Other questions:
  • If a database named Contacts has a table named tblEmployees and another database named Orders links to that tblEmployees table,
    8·1 answer
  • Is anyone else experiencing the wording::nonifacation::glitch about the "5 hours ago" thingy to whenever you answer a question o
    7·2 answers
  • A simple way to think of the Excel application is as a giant ______.
    5·2 answers
  • When you compose a message, you want your audience to find the information it needs quickly and to understand what it finds. You
    11·1 answer
  • What is human data,
    8·1 answer
  • Pleasee help. How do you fix this problem in discord?
    10·1 answer
  • Please anyone, help me.... I'm not sure how to put these all together.<br> 35 points!
    15·2 answers
  • What steps can be used to password-protect a worksheet?
    14·1 answer
  • How should you schedule a meeting with someone in another time zone?
    7·1 answer
  • What to do if you click on a phishing link on iphone
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!