Four Part A: Hours Enrolled |
- In this Lab you are going to create a complete C++ program. Please follow
the steps below:
- Open the Dev C++ compiler by clicking on "Start" then "All Programs" then
"Programming Tools" then "Bloodshed Dev C++" then "Dev C++"
- Open your template.cpp.
- Save your program as "lab4a.cpp".
- Enter the Program found on page 102, Figure 4-30 in your text.
- NOTE: If you start with the template, some of these changes will already be there. Make
the necessary changes to show:
- Comments at the top of your program with your name and correct lab number.
- Before the statement in main
return 0;
The following statement
system ("pause");
- All programs for this
course will require a description() function. To write the description()
function you will need:
- a prototype below your directives. Place the following code after your directives:
void description();
- a function call to invoke the function. Place the following code inside your main() function
after you have declared your variables:
description();
- the description() function.
Place your function after you have closed your main() function
block. Your description() function will describe what your program does
and will be cout statements:
void description()
{
cout << "place your description here" << endl;
}
- Select "Execute" then "Compile"
- Select "Execute" then "Run"
- When prompted by the program enter the hours that you are enrolled this semester at ACC
- Copy and paste the output from the DOS window as a block comment at the
end of your C++ program by right clicking on the C++, selecting "Edit" then
"Mark" then highlighting all of the text. Next select "Edit" again then
"Copy". Set the cursor at the end of your source file and select
"Edit" then "Paste". Make sure that you put a "/*" before the output and
an "*/" at the end of the comments.
- Save the file by selecting "File" then "Save".
- Save the lab lab4a.cpp
- Email the cpp file (with
the output pasted in comments) to jscholl@austincc.edu.
|
Four Part B: Hours Enrolled |
- In this Lab you are going to update lab4a.cpp. Please follow the steps below:
- Open the Dev C++ compiler by clicking on "Start" then "All Programs" then
"Programming Tools" then "Bloodshed Dev C++" then "Dev C++"
- Open your lab4a.cpp.
- Save your program as "lab4b.cpp".
- Create a function called int getHours()
This requires:
- the prototype placed above your main function
int getHours();
- the call place in place of lines 16 and 17 shown in the text
hours = getHours();
- the function definition placed below the closing brace of your main function
int getHours()
{
int hours;
cout << "Hours enrolled? ";
cin >> hours;
return hours;
}
- Select "Execute" then "Compile"
- Select "Execute" then "Run"
- When prompted by the program enter the hours that you are enrolled this semester at ACC
- Copy and paste the output from the DOS window as a block comment at the
end of your C++ program by right clicking on the C++, selecting "Edit" then
"Mark" then highlighting all of the text. Next select "Edit" again then
"Copy". Set the cursor at the end of your source file and select
"Edit" then "Paste". Make sure that you put a "/*" before the output and
an "*/" at the end of the comments.
- Save the file by selecting "File" then "Save".
- Save the lab lab4b.cpp
- Email the cpp file (with
the output pasted in comments) to jscholl@austincc.edu.
|
Five: Fat |
- In this Lab you are going to create a complete C++ program. Please follow
the steps below:
- Open the Dev C++ compiler by clicking on "Start" then "All Programs" then
"Programming Tools" then "Bloodshed Dev C++" then "Dev C++"
- Either open your template.cpp or create a new source file by selecting
"File" then "New" then "Source File"
- Save your program as "lab5.cpp".
- Enter the instructions shown in Figure 5-33 on pages 148 - 149 with the following change
Line 23 should be:
if (totalCals > 0 && fatGrams >= 0)
- NOTE: If you start with the template, some of these changes will already be there. Make
the necessary changes to show:
- Comments at the top of your program with your name and correct lab number.
- Before the statement in main
return 0;
The following statement
system ("pause");
- Update the code to include three functions. (This requires a prototype, call, and function definition for each function.)
- void description();
- int getTotalCalories();
- int getFatGrams();
- Select "Execute" then "Compile"
- Select "Execute" then "Run"
- You are to execute the program 3 times using the input specified in Figure 5-32
on page 148 of your text book. Be sure to copy and save ALL 3 sets of output as
comments as instructed below.
- Copy and paste the output from the DOS window as a block comment at the end of
your C++ program by right clicking on the C++, selecting "Edit" then "Mark"
then highlighting all of the text. Next select "Edit" again then "Copy". Set the
cursor at the end of your source file and select "Edit" then "Paste". Make sure
that you put a "/*" before the output and an "*/" at the end of the comments.
- Email the cpp file (with
the output pasted in comments) to jscholl@austincc.edu.
|
Six: Sales Commission |
-
Please follow the steps below:
- Open the Dev C++ compiler by clicking on "Start" then "All Programs" then
"Programming Tools" then "Bloodshed Dev C++" then "Dev C++"
- Either open your template.cpp or create a new source file by selecting
"File" then "New" then "Source File"
- Save your program as "lab6.cpp".
- Enter the instructions shown in Figure 6-32 on page 193.
- NOTE: If you start with the template, some of these changes will already be there. Make
the necessary changes to show:
- Comments at the top of your program with your name and correct lab number.
- Before the statement in main
return 0;
The following statement
system ("pause");
- Update the code to include four functions. (This requires a prototype, call,
and function definition for each function.)
- void description();
- int getSales();
- double calcCommission(int sales);
The call for calcCommission should be placed before the code shown in lines
19 - 27. That call is written:
commission = calcCommission(sales);
The function definition is written below the closing brace of the function definition
of getSales() and is written:
double calcCommission(int sales)
{
double commission;
the code written in lines 19 to 27 of the text
return commission;
}
- void displayCommission(double commission);
The call for displayCommission should be placed before the code shown in lines
30 - 37. That call is written:
displayCommission(commission)
The function definition is written below the closing brace of the function definition
calcCommission(); and is written:
void displayCommission(double commission)
{
the code written in lines 30 - 37 of the text
}
- Select "Execute" then "Compile"
- Select "Execute" then "Run".
- You are to execute the program 4 times using the input specified in Figure 6-31
on page 192 of your text book. Be sure to copy and save ALL 4 sets of output as
comments as instructed below.
- Copy and paste the output from the DOS window as a block comment at the end of
your C++ program by right clicking on the C++, selecting "Edit" then "Mark" then
highlighting all of the text. Next select "Edit" again then "Copy". Set the cursor
at the end of your source file and select "Edit" then "Paste". Make sure that you put
a "/*" before the output and an "*/" at the end of the comments.
- Be sure that you put your name and today's date in the comments at the top of the
file then save the file by selecting "File" then "Save"
- Email the cpp file (with
the output pasted in comments) to jscholl@austincc.edu.
|
Seven: Grade |
- In this Lab you are going to create a complete C++ program.
Please follow the steps below:
- Open the Dev C++ compiler by clicking on "Start" then "All Programs" then
"Programming Tools" then "Bloodshed Dev C++" then "Dev C++".
- Either open your template.cpp or create a new source file by selecting
"File" then "New" then "Source File"
- Save your program as "lab7.cpp".
- NOTE: If you start with the template, some of these changes will already be there. Make
the necessary changes to show:
- Comments at the top of your program with your name and correct lab number.
- Before the statement in main
return 0;
The following statement
system ("pause");
- Create additional functions:
- void description();
- int getScore(string);
- void displayGrade(int, char);
- Select "Execute" then "Compile"
- Select "Execute" then "Run".
- You are to execute the program 2 times using the input specified in Figure 7-47 on page 246
of your text book. Be sure to copy and save both sets of output as comments as instructed below.
Be sure to copy and save ALL sets of output as comments as instructed below.
- Copy and paste the output from the DOS window as a block comment at the end
of your C++ program by right clicking on the C++, selecting "Edit" then
"Mark" then highlighting all of the text. Next select "Edit" again then
"Copy". Set the cursor at the end of your source file and select "Edit" then
"Paste". Make sure that you put a "/*" before the output and an "*/" at the
end of the comments.
- Be sure that you put your name and today's date in the comments at the top of the
file then save the file by selecting "File" then "Save".
- Email the cpp file (with
the output pasted in comments) to jscholl@austincc.edu.
|
Nine: Car Payment |
- In this Lab you are going to create a complete C++ program.
Please follow the steps below:
- Open the Dev C++ compiler by clicking on "Start" then "All Programs" then
"Programming Tools" then "Bloodshed Dev C++" then "Dev C++".
- Either open your template.cpp or create a new source file by selecting
"File" then "New" then "Source File"
- Save your program as "lab9.cpp".
- Enter the instructions shown in Figure 9-46 on pages 353 - 354.
- NOTE: If you start with the template, some of these changes will already be there. Make
the necessary changes to show:
- Comments at the top of your program with your name and correct lab number.
- Before the statement in main
return 0;
The following statement
system ("pause");
- Create additional functions for description, all input, and to display payments.
- Select "Execute" then "Compile".
- Select "Execute" then "Run".
- You are to execute the program using the input specified in Figure 9-45 on page 352
- Copy and paste the output from the DOS window as a block comment at the end of your
C++ program by right clicking on the C++, selecting "Edit" then "Mark" then highlighting
all of the text. Next select "Edit" again then "Copy". Set the cursor at the end of your
source file and select "Edit" then "Paste". Make sure that you put a "/*" before the
output and an "*/" at the end of the comments.
- Be sure that you put your name and today's date in the comments at the top of the
file then save the file by selecting "File" then "Save".
- Email the cpp file (with
the output pasted in comments) to jscholl@austincc.edu.
|
Ten: Electricity |
- In this Lab you are going to create a complete C++ program.
Please follow the steps below:
- Open the Dev C++ compiler by clicking on "Start" then "All Programs" then
"Programming Tools" then "Bloodshed Dev C++" then "Dev C++".
- Either open your template.cpp or create a new source file by selecting
"File" then "New" then "Source File"
- Save your program as "lab10.cpp".
- NOTE: If you start with the template, some of these changes will already be there. Make
the necessary changes to show:
- Comments at the top of your program with your name and correct lab number.
- Before the statement in main
return 0;
The following statement
system ("pause");
- Select "Execute" then "Compile".
- Select "Execute" then "Run".
- You are to execute the program 2 times using the input specified in Figure 10-32 on page 399
of your text book. Be sure to copy and save both sets of output as comments as instructed below.
- Copy and paste the output from the DOS window as a block comment at the end of
your C++ program by right clicking on the C++, selecting "Edit" then "Mark" then
highlighting all of the text. Next select "Edit" again then "Copy". Set the cursor at
the end of your source file and select "Edit" then "Paste". Make sure that you put a
"/*" before the output and an "*/" at the end of the comments.
- Be sure that you put your name and today's date in the comments at the top of
the file then save the file by selecting "File" then "Save".
- Email the cpp file (with
the output pasted in comments) to jscholl@austincc.edu.
|
Eleven: Rainfall |
- In this Lab you are going to create a complete C++ program.
Please follow the steps below:
- Open the Dev C++ compiler by clicking on "Start" then "All Programs" then
"Programming Tools" then "Bloodshed Dev C++" then "Dev C++".
- Either open your template.cpp or create a new source file by selecting
"File" then "New" then "Source File"
- Save your program as "lab11.cpp".
- NOTE: If you start with the template, some of these changes will already be there. Make
the necessary changes to show:
- Comments at the top of your program with your name and correct lab number.
- Before the statement in main
return 0;
The following statement
system ("pause");
- Enter the instructions shown in Figure 11-57 on pages 469 - 470 in a file called "Lab11.cpp".
- Add additional functions for description(), getRainfall(), and getChoice().
- Select "Execute" then "Compile".
- Select "Execute" then "Run".
- You are to execute the program 2 times using the input specified in Figure 11-58 on page 471 of your text book.
Be sure to copy and save both sets of output as comments as instructed below.
- Copy and paste the output from the DOS window as a block comment at the end of
your C++ program by right clicking on the C++, selecting "Edit" then "Mark" then
highlighting all of the text. Next select "Edit" again then "Copy". Set the cursor at
the end of your source file and select "Edit" then "Paste". Make sure that you put a
"/*" before the output and an "*/" at the end of the comments.
- Be sure that you put your name and today's date in the comments at the top of
the file then save the file by selecting "File" then "Save".
- Email the cpp file (with
the output pasted in comments) to jscholl@austincc.edu.
|
Twelve: Shipping Charges |
- In this Lab you are going to create a complete C++ program.
Please follow the steps below:
- Open the Dev C++ compiler by clicking on "Start" then "All Programs" then
"Programming Tools" then "Bloodshed Dev C++" then "Dev C++".
- Either open your template.cpp or create a new source file by selecting
"File" then "New" then "Source File"
- Save your program as "lab12.cpp".
- NOTE: If you start with the template, some of these changes will already be there. Make
the necessary changes to show:
- Comments at the top of your program with your name and correct lab number.
- Before the statement in main
return 0;
The following statement
system ("pause");
- Enter the instructions shown in Figure 12-25 on page 513 in a file called "Lab12.cpp".
- Add additional functions for description(), getNumOrdered(), and displayCharges().
- Select "Execute" then "Compile".
- Select "Execute" then "Run".
- You are to execute the program 1 time using the input specified in Figure 12-26 on page 514
of your text book. Be sure to copy and save your output as comments as instructed below.
- Copy and paste the output from the DOS window as a block comment at the end of
your C++ program by right clicking on the C++, selecting "Edit" then "Mark" then
highlighting all of the text. Next select "Edit" again then "Copy". Set the cursor at
the end of your source file and select "Edit" then "Paste". Make sure that you put a
"/*" before the output and an "*/" at the end of the comments.
- Be sure that you put your name and today's date in the comments at the top of
the file then save the file by selecting "File" then "Save".
- Email the cpp file (with
the output pasted in comments) to jscholl@austincc.edu.
|
Thirteen: Hang Man |
- In this Lab you are going to create a complete C++ program.
Please follow the steps below:
- Open the Dev C++ compiler by clicking on "Start" then "All Programs" then
"Programming Tools" then "Bloodshed Dev C++" then "Dev C++".
- Either open your template.cpp or create a new source file by selecting
"File" then "New" then "Source File"
- Save your program as "Lab13.cpp".
- NOTE: If you start with the template, some of these changes will already be there.
Make the necessary changes to show:
- Comments at the top of your program with your name and correct lab number.
- Before the statement in main
return 0;
The following statement
system ("pause");
- Enter the instructions shown in Figure 13-42 on pages 564 - 566 in a file called "Lab13.cpp".
- Add additional functions for description(), getOrigWord()--the function getOrigWord() should
include lines 19 - 27 where a loop in the function that only returns to main after a word
of 5 characters has been entered, and clears the screen before returning to main, and getLetter().
- Select "Execute" then "Compile".
- Select "Execute" then "Run".
- You are to execute the program 2 times using the input specified in Figures 13-43
AND 13-44 on page 566 of your text book. Be sure to copy and save BOTH sets of output
as comments as instructed below.
- Copy and paste the output from the DOS window as a block comment at the
end of your C++ program by right clicking on the C++, selecting "Edit" then
"Mark" then highlighting all of the text. Next select "Edit" again then
"Copy". Set the cursor at the end of your source file and select "Edit"
then "Paste". Make sure that you put a "/*" before the output and an "*/"
at the end of the comments.
- Be sure that you put your name and today's date in the comments at the top
of the file then save the file by selecting "File" then "Save".
- Email the cpp file (with
the output pasted in comments) to jscholl@austincc.edu.
|
Fourteen: Files |
- In this Lab you are going to create a complete C++ program.
Please follow the steps below:
- Open the Dev C++ compiler by clicking on "Start" then "All Programs" then
"Programming Tools" then "Bloodshed Dev C++" then "Dev C++".
- Either open your template.cpp or create a new source file by selecting
"File" then "New" then "Source File"
- Save your program as "lab14.cpp".
- NOTE: If you start with the template, some of these changes will already be there.
Make the necessary changes to show:
- Comments at the top of your program with your name and correct lab number.
- Before the statement in main
return 0;
The following statement
system ("pause");
- Enter the instructions shown in Figure 14-20 on pages 609 - 611 in a file called "Lab14.cpp".
- Add additional functions for description().
- Select "Execute" then "Compile".
- Select "Execute" then "Run".
- You are to execute the program using the input specified in Figure 14-21 on page 611 of your
text book. Be sure to copy and save your output as comments as instructed below.
- Copy and paste the output from the DOS window as a block comment at the end
of your C++ program by right clicking on the C++, selecting "Edit" then
"Mark" then highlighting all of the text. Next select "Edit" again then "Copy".
Set the cursor at the end of your source file and select "Edit" then "Paste".
Make sure that you put a "/*" before the output and an "*/" at the end of the comments.
- Be sure that you put your name and today's date in the comments at the top of
the file then save the file by selecting "File" then "Save".
- Email the cpp file (with
the output pasted in comments) AND your sales.txt file to jscholl@austincc.edu.
|
|
|
|