Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program 1 Attached Files: // This progam calculates the user's pay. #include using namespace std; int main() { double hours, rate, pay; // Get the

Program 1

Attached Files:

// This progam calculates the user's pay. #include  using namespace std; int main() { double hours, rate, pay; // Get the number of hours worked. cout << "How many hours did you work? "; cin >> hours; // Get the hourly pay rate. cout << "How much do you get paid per hour? "; cin >> rate; // Calculate the pay. pay = hours * rate; // Display the pay. cout << "You have earned $" << pay << endl; return 0; }In this exercise, we will use our installed C++ compilers to compile pr1-1.cpp program. The exercise will:
  • Show how a compiler creates an executable file from a C++ source program
  • Familiarize ourselves with the IDE
  • Show how the program calculates pay amount based on two inputs from the console

Instructions:

  1. Download the attached .cpp from Blackboard.
  2. Open the program using a text editor.
  3. In your IDE, create a new C++ project. Create a new C++ program. This brings up an IDE editor.
  4. Copy and paste the program from the text editor to the IDE editor.
  5. Edit the program and add a line before the return 0; statement.
  6. On the new line, type the following code: cout << "Submitted by: your-name" << endl;
  7. Compile (Build) the program and see the output if no errors from compilation.
  8. Run the program. There will be a console prompt with instructions to enter the hours worked and hourly rate.
  9. The result of the calculation for pay will be displayed on the console.
  10. Take a screen image of the results and upload the image to the Blackboard assignment.

Program 2

Attached Files:

// This program has variables of several of the integer types. #include  using namespace std; int main() { double checking; unsigned int miles; long diameter; checking = -20.50; miles = 4276; diameter = 100000; cout << "We have made a long journey of " << miles; cout << " miles." << endl; cout << "Our checking account balance is " << checking; cout << "The galaxy is about " << diameter; cout << " light years in diameter."; return 0; }In this exercise, we will learn how variables are defined in a program, and various integer data types.
  1. Download the attached pr2-10.cpp and open in your IDE
  2. Compile the program.
  3. Execute the program and make a screen print of the output.
  4. Upload the screen print to this exercise.

Program 3

Attached Files:

// This program calculates hourly wages, including overtime. #include  using namespace std; int main() { double regularWages, // To hold regular wages basePayRate = 18.25, // Base pay rate regularHours = 40.0, // Hours worked less overtime overtimeWages, // To hold overtime wages overtimePayRate = 27.78, // Overtime pay rate overtimeHours = 10, // Overtime hours worked totalWages; // To hold total wages // Calculate the regular wages. regularWages = basePayRate * regularHours; // Calculate the overtime wages. overtimeWages = overtimePayRate * overtimeHours; // Calculate the total wages. totalWages = regularWages + overtimeWages; // Display the total wages. cout << "Wages for this week are $" << totalWages << endl; return 0; } In this exercise, we will learn how variables are defined in a program, and various integer data types.
  1. Download the attached pr2-21.cpp and open in your IDE
  2. Compile the program.
  3. Execute the program and make a screen print of the output.
  4. Upload the screen print to this exercise.

Program 3

Attached Files:

// This program converts seconds to minutes and seconds. #include  using namespace std; int main() { // The total seconds is 125. int totalSeconds = 125; // Variables for minutes and seconds int minutes, seconds; // Get the number of minutes. minutes = totalSeconds / 60; // Get the remaining seconds. seconds = totalSeconds % 60; // Display the results. cout << totalSeconds << " is equivalent to: "; cout << "Minutes: " << minutes << endl; cout << "Seconds: " << seconds << endl; return 0; }

In this exercise, we will use our installed C++ compilers to compile the downloaded C++ program. The exercise will:

This C++ program uses division. Instructions:

  1. Download the attached C++ program from Blackboard.
  2. Open the program using a text editor.
  3. In your IDE, create a new C++ project. Create a new C++ program. This brings up an IDE editor.
  4. Copy and paste the program from the text editor to the IDE editor.
  5. Add a new line before the return 0; statement with this code: cout << "Submitted by: your-name" << endl;
  6. Compile (Build) the program and see the output if no errors from compilation.
  7. Run the program. If there are console prompts, enter data requested, otherwise the program is an output only program. Check for errors, if any.
  8. Take a screen image the results and upload the image to the Blackboard assignment.

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

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

Question What happens to my plan if I die?

Answered: 1 week ago