COMP 2710: Homework 1 solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (4 votes)

A government research lab has concluded that an artificial sweetener commonly used in
diet soda will cause death in laboratory mice. A friend of yours is desperate to lose
weight but cannot give up soda. Your friend wants to know how much diet soda it is
possible to drink without dying as a result. Write a program to supply the answer. The
input to the program is the amount of artificial sweetener needed to kill a mouse, the
weight of the mouse, and the weight of the dieter. To ensure the safety of your friend,
be sure the program requests the weight at which the dieter will stop dieting, rather
than the dieter’s current weight. Assume that diet soda contains one‐tenth of 1%
artificial sweetener. Use a variable declaration with the modifier const to give a name
to this fraction. You may want to express the percentage as the double value 0.001.
Programming Environment:
Write a short program in C++. Compile and run it using the g++ compiler on a Linux box
(either in computer labs in Shelby, your home Linux machine, a Linux box on a virtual
machine, or using an emulator like Cygwin).
Requirements:
1. (5 points) Use comments to provide a heading at the top of your code
containing your name, Auburn Userid, filename, and how to compile your code.
Also describe any help or sources that you used (as per the syllabus).
2. (5 points) Your source code file should be named as “hw1.cpp”.
3. (10 points) No compilation errors and no warning messages.
4. (10 points) Use modifier const for the fraction.
5. (10 points) Usability of your program (e.g., input and output).
6. (60 points) Quality of your source code.
You will lose points if you: do not use the specific program file name, or do not have a
comment block on EVERY program you hand in.
Here is a sample dialog (where the user input is depicted as Bold, but you do not need
to display user input in bold.):
Your program’s output should match the style of the sample output.
Deliverables:
 A heading at the top of your code contains your name, Auburn Userid, filename,
and how to compile your code.
 Submit your source code file named as “hw1.cpp” through Canvas.
Late Submission Penalty:
 Ten percent (10%) penalty per day for late submission. For example, an
assignment submitted after the deadline but up to 1 day (24 hours) late can
achieve a maximum of 90% of points allocated for the assignment. An
assignment submitted after the deadline but up to 2 days (48 hours) late can
achieve a maximum of 80% of points allocated for the assignment.
 Assignment submitted more than 3 days (72 hours) after the deadline will not be
graded.
Rebuttal period:
 You will be given a period of 7 days to read and respond to the comments and
grades of your homework or project assignment. The TA may use this
opportunity to address any concerns and questions you have. The TA also may
ask for additional information from you regarding your homework or project.
What is the amount of artificial sweetener needed to kill a mouse:
0.002
What is the weight of the mouse: 1
What is the weight of the dieter: 114
You can drink 228 diet soda without dying as a result.