Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that prompts for a person's age in years and heart beats rate per minute. The program computes and output the number
Write a program that prompts for a person's age in years and heart beats rate per minute. The program computes and output the number of heart beats since the person was born. You may assume that there are 365 days in a year. Note: Use constants whenever necessary Input/ Output Sample: input Enter the person's age in years: 21 Enter the heart beats rate per minute: 71 The estimated number of heartbeats since the person was born is: 7.8367c+08 2. One metric ton is approximately 2205 pounds. A bag can hold N pounds of rice. Write a program that prompts the user to input the amount of rice in tons and the bag's capacity in pounds. The program then outputs the number of bags needed to store the specified amount of rice. Example: If the amount of rice is 3 tons and the bag's capacity is 12 pounds, then there are 3 * 2205 = 6615 pounds of rice altogether and 6615 / 12 = 551.25 552 bags. (Hint: you may use the ceil function) Start by writing an algorithm you can follow to solve the problem. Input/Output Sample: Enter the amount of rice in tons: 3 Enter the bag's capacity in pounds: 12 You will need approximately 552 bags to store the rice. 3. A real number with only one decimal place is entered. Write a program that reverses it. For example, if the input is 9.4, the answer should be 4.9. Input/Output Sample: input Enter a real number with one decimal place: 9.4 The reversed number is: 4.9 Chapter 4: Selection Statements 4. SEWA Bill: Write a program that prompts the user to enter the amount of consumed water in gallons and electricity in watts. The program calculates the bill assuming that the water and electricity rates are as in the following table: Water Gallons 850 Input/Output Sample: input Rate 0.75 1.15 2.75 Electricity Electricity Bill is AED 2000.43 Total Bill is AED 2346.06 Watts 2500 > 2500 Rate 0.5 0.8 Enter the amount of the water consumed in gallons: 300.546 Enter the amount of electercity consumed in watts: 2500.54 Water Bill is AED 345.628 input Objectives: . . . Basic practice on arithmetic operations. Basic practice on selection control. Basic practice on writing simple C++ programs. Exercise 1 2 3 4 5 Out of 2 2 2 2 2 Mark
Step by Step Solution
There are 3 Steps involved in it
Step: 1
1...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started