Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My professor just gave me such a project and no more information. Write a Program: Daily Supplement Cost Your horse has to have 1 ounce

My professor just gave me such a project and no more information.

image text in transcribed
Write a Program: Daily Supplement Cost Your horse has to have 1 ounce of probiotic supplement a day. You can buy it per pound, as a 10 lb pail at a 10% discount, or as a 20 lb pail at a 15% discount. Your goal is to produce formatted output showing the daily cost for each buying option. You should ask the user to enter the price per lb. Your program should have the following: I You should have 4 comment lines at the top: description of the program, author, section, and date. (1 point) 0 Create as many variables as you need, use the appropriate type, name them appropriately (camelback notation preferred), and remember to not leave them uninitialized. (2 points) 0 Create named constants for what's appropriate. Keep in mind the two rules for named constants: they need to have a well-defined meaning that you can express in a name, and they should be unlikely to change, Use the standard convention for constant names. (3 points) 0 Ask the user to enter a price per lb and read it from the console. (1 point) - Calculate the daily cost for each buying option. Use your knowledge of operator precedence and only use parentheses as appropriate (3 points] I Write the result to the console. Use stream manipulators to format your output. Your cost per dayshould be displayed as a table with evenly spaced aligned columns. You should also use the xed-point notation with two digits after the decimal point. Your output should look similar to this: (5 points) Enter price per lb: $18.50 Buying option 1 lb 5 lb 10 lb Cost per day (5) 1.16 1.04 0.98 Notes: > Pay attention to where you create and how you initialile your variables. Unsafe code is a lepoint deduction. > Comment your code. Uncommented code is also a lepoint deduction. > Refer to code examples published for this week

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions