You will be working in pairs during labs. Pairs will be selected and announced by the TA. You will discuss the programs with your partner, but you will still be typing in your own code to show to the TA. You can help each other debug, give plenty of suggestions and hints, **explain** why things work or don't work, etc.
Write a program that generates possible email addresses. The program should read in the users first name, then their middle initial, followed by their last name. It should then output 4 suggestions for email addresses. The 4 suggestions should be determined as follows:
You do not need to save these email addresses in a string object using concatenation. Just output them.
Enter your first name: Kris
Enter your middle initial: T
Enter your last name: Miller
Here are some suggestions for email addresses:
KMiller
KrisM
KTM6
KrisM10
Enter your first name: George
Enter your middle initial: W
Enter your last name: Bush
Here are some suggestions for email addresses:
GBush
GeorgeB
GWB4
GeorgeB10
Write a program that reads in 4 items at a department store, the quantity to be purchased of each item, and the cost for each item. Calculate the price for each item before and after sales tax and then calculate the total amount of the purchase including sales tax. The sales tax is 7.75%. Your output should look like the following example.
Enter item 1: T-shirts
Enter quantity: 5
Enter cost of item: 13.99
Enter item 2: Socks
Enter quantity: 4
Enter cost of item: 4.99
Enter item 3: Shorts
Enter quantity: 2
Enter cost of item: 15.99
Enter item 4: Shoes
Enter quantity: 1
Enter cost of item: 69.99
Item Quantity Cost(Before Tax) Sales Tax Total
--------------------------------------------------------------------
1. T-shirts 5 69.95 5.42 75.37
2. Socks 4 19.96 1.55 21.51
3. Shorts 2 31.98 2.48 34.46
4. Shoes 1 69.99 5.42 75.41
-----
206.75
Fix all syntax and logic errors in the following program so that it compiles and runs correctly. You should copy-and-paste this code to your file rather than type it.
#include <iostreem>
using namespace std;
int main
{
double num1, num2;
// Get 2 floating-point values from user
cout << "Enter 2 floating-point values:";
cin >> num1, num2;
// Use fixed notation and 2 digits after the decimal for all outputs
cout << fixed << setprecision(2);
// Demonstrate arithmetic operators
cout << "num1 + num2 = " << num1 + num2;
cout << "num1 - num2 = " << num1 - num2;
cout << "num1 * num2 = " << num1 * num3;
cout << "num1 / num2 = " << num1 / num2;
cout << "num1 % num2 = " << num1 % num2;
// Output average of inputs
cout << "\nAverage of num1 and num2 =
<< (num1 + num2) / 2.0
return 0;
}