Create an application that determines miles-per-gallon if


Part 1: Write, Run, and Observe the Application

Review Hello World!, Variables and Basic IO and create an application that determines miles-per-gallon, if you know the number of miles driven and number of gallons of gas you put in the tank.

Follow these steps to complete Part 1 of your assignment.

1. Access the Toolwire desktop environment via the Toolwire resources in Unit 1.

2. Launch Code::Blocks.

3. Click the following:
- File, New, Project.
- Console Application.
- Go.
- Next.
- C++.
- Next.

4. In the Project Title field, type calcMileage.

5. In Folder to create project in:, click ...

6. In Folder, click Make New folder and type calcMileage.

7. Click the calcMileage folder.

8. Click OK.

9. Click Next.

10. Click Finish.

11. Open the main.cpp file under Sources.

12. In the editor, type the following calcMileage application, using this template.
#include

using namespace std;

int main()
{
int miles;
int gallons;
float mpg;

cout << "Enter miles: ";
cin >> miles;
cout << "Enter gallons: ";
cin >> gallons;
mpg = miles / gallons;
cout << "Miles per gallon: " << mpg;
return 0;
}

13. Click Build, Build and Run.

14. Enter the number of miles.

15. Enter the number of gallons.

16. Observe the results.

17. Assignment Overview

18. For this assignment, you will write your first C++ application, called calcMileage. The goal of this program is to determine miles-per-gallon based on the number of miles driven and the number of gallons of gas you put in the tank. You will use the Code::Blocks software to write this application. Access this software via the Toolwire virtual desktop activity link in this unit.

19.

20. Assignment Instructions

21. Part 1: Write, Run, and Test the Application

22.

23. Use the code in the Unit 1, Part 1 Assignment Instructions document linked in the Resources to complete this part of your assignment. Be sure to test the application with a variety of values before you proceed to Part 2. The program produces accurate results with some numeric values but not with others. Note when the results are accurate and when they are not.

24.

25. Part 2: Improve the Application

26.

27. Based on the material in the study, modify the code to fix the accuracy problem. Be sure to comment and format the code.

28.

29. Part 3: Describe the Application

30.

31. After running your application and observing the results, write a 1-2 page paper in which you complete the following:

32.

33. Define the variables in an application.

34. Define the expressions in an application.

35. Explain the data types in an application.

36. Discuss the cause of the inaccuracy in the original code and the approach used to fix the problem.

37. Ensure that your writing is professional and consistent with the standards and conventions of the IT community.

38.

39. Submit both the .cpp source code file and the Word document with the paper.

40.

41. Submission Requirements

42. Refer to the Variables, Expressions, and Data Types Assessment Scoring Guide to ensure that you meet the grading criteria for this assessment.

43.

44. Your completed assignment should include the following:

45.

46. Demonstrate the ability to apply math in a program.

47. Define the variables in an application.

48. Define the expressions in an application.

49. Explain the data types in an application.

50. Communicate effectively in a business environment.

When complete, compress your C++ program into a ZIP archive and submit your archive in the assignment area.

Be sure to name your archive using the following format IT3348_u01a1_FirstName_LastName.zip

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Create an application that determines miles-per-gallon if
Reference No:- TGS01633357

Now Priced at $60 (50% Discount)

Recommended (95%)

Rated (4.7/5)