Starting from:

$30

COMP2710-Homework 1 Develop, Compile, and Run C++ Code and Modifier Const in C++ Solved

Goals: 

•        To find someplace where you can develop, compile, and run C++ code.

•        To learn modifier const in C++

•        To write a very simple C++ program and learn a few things like variables, expressions, assignment statements, console input/output, and namespaces. 

 

Project Description:

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++.  Files will be graded using the jGrasp on a CoE PC.

 

Requirements:

1. Use comments to provide a heading at the top of your code containing your name and Auburn Userid, partner’s name and Auburn ID <or “NONE”, filename.  Also, describe any help or sources that you used (as per the syllabus). Include a brief statement of the problem.

// name: Sally Ride, szr0001

// partner: Lizz Jones, lzj0001                   (“NONE” if work alone)

// filename: hw01.cpp

// due date: 08/31/2018

// collaboration: I got help with data types from the TA.

    (OR “I did not use any external sources for this assignment.”)

// problem: determine how much diet soda it is possible to drink  

//    without dying as a result

2.Your source code file should be named as “hw1.cpp”.  3. (10 points) No compilation error and no warning messages

4.Use modifier const for the fraction.

5. Usability of your program (e.g., input and output)

6. 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.):

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.

 
 

Your program's output should match the style of the sample output.

More products