Question

In: Computer Science

Instructions (No array) (c++) (visual studio) 1. Create a project called Project3B 2. Create 3 String...

Instructions (No array) (c++) (visual studio)

1. Create a project called Project3B
2. Create 3 String variables called name1, name2, name3
3. Create 9 double variables called test1_1, test1_2, test1_3, test2_1, test2_2, test2_3, test3_1, test3_2, test3_3
4. Create 3 double variables called average1, average2, average3
To calculate the average score = (test1 + test2 + test3) / 3.0
5. Run the program with the following data using cin
name1 = “Tom”, name2 = “Mary”, name3 = “Ali”
test1_1 = 81.4, test1_2 = 92.1, test1_3 = 75.5
test2_1 = 98.7, test2_2 = 93.5, test2_3 = 90.1
test3_1 = 64.2, test3_2 = 75.8, test3_3 = 78.4
6. Display the output using cout and setw()

Solutions

Expert Solution

#include <iostream>
#include <iomanip> 
#include <ios> 
using namespace std;

int main() {
  string name1,name2,name3;
  double test1_1, test1_2, test1_3, test2_1, test2_2, test2_3, test3_1, test3_2, test3_3;
  double average1, average2, average3;
  cout << "name1 = ";
  cin >> name1; 
  cout << "name2 = ";
  cin >> name2; 
  cout << "name3 = ";
  cin >> name3; 
  cout << "Marks of " << setw(7) << name1 << " in test1 = ";
  cin >> test1_1; 
  cout << "Marks of " << setw(7) << name1 << " in test2 = ";
  cin >> test1_2; 
  cout << "Marks of " << setw(7) << name1 << " in test3 = ";
  cin >> test1_3; 
  cout << "Marks of " << setw(7) << name2 << " in test1 = ";
  cin >> test2_1; 
  cout << "Marks of " << setw(7) << name2 << " in test2 = ";
  cin >> test1_2; 
  cout << "Marks of " << setw(7) << name2 << " in test3 = ";
  cin >> test1_3; 
  cout << "Marks of " << setw(7) << name3 << " in test1 = ";
  cin >> test3_1; 
  cout << "Marks of " << setw(7) << name3 << " in test2 = ";
  cin >> test3_2; 
  cout << "Marks of " << setw(7) << name3 << " in test3 = ";
  cin >> test3_3; 
  average1 = (test1_1 + test1_2 + test1_3)/3.0;
  average2 = (test2_1 + test2_2 + test2_3)/3.0;
  average3 = (test3_1 + test3_2 + test3_3)/3.0;
  cout << "average of " << setw(7) << name1 << " is " << setw(7) << average1 << "\n"
       << "average of " << setw(7) << name2 << " is " << setw(7) << average2 << "\n"
       << "average of " << setw(7) << name3 << " is " << setw(7) << average3 << endl;

}

Output:


Related Solutions

Create a C++ project in visual studio. You can use the C++ project that I uploaded...
Create a C++ project in visual studio. You can use the C++ project that I uploaded to complete this project. 1. Write a function that will accept two integer matrices A and B by reference parameters, and two integers i and j as a value parameter. The function will return an integer m, which is the (i,j)-th coefficient of matrix denoted by A*B (multiplication of A and B). For example, if M = A*B, the function will return m, which...
Create a Visual Studio console project using c++ void lowerToUpper(std::string & sentence) that iterates over all...
Create a Visual Studio console project using c++ void lowerToUpper(std::string & sentence) that iterates over all characters in the sentence argument. Any lowercase letter should be converted to uppercase. This can be done by including <cctype> and testing each character in sentence with the islower() function. If islower(sentence[i]) returns true then sentence[i] should be replaced with toupper(sentence[i]). The main() function should assign "Hello how are you doing?" to sentence, call lowerToUpper(sentence), and use an if statement to check the new...
Create a C# .NET Core Console project in Visual Studio. (This is the same kind of...
Create a C# .NET Core Console project in Visual Studio. (This is the same kind of project we have been doing all semester.) Do all of the following in the Program class. You do not need to add any other classes to this project. 2. If it exists, remove the Console.WriteLine(“Hello World!”); line that Visual Studio created in the Program class. 3. At the very top of the Program.cs page you should see using System; On the empty line below...
Create an ASP.Net Website using Visual Studio with C#: Create a simple calculator that has 3...
Create an ASP.Net Website using Visual Studio with C#: Create a simple calculator that has 3 text boxes: 2 of them to enter numbers, the 3rd one displays the results Create 4 buttons to add, subtract, multiply, and divide Prevent the user from entering text in the number fields Display a message indicating “cannot divide by” when the user click “/” and there is a zero the in the second box Create two additional buttons: - One to store data...
Create a new “Area” project. Create a new Visual Studio Project and call it “Area”. This...
Create a new “Area” project. Create a new Visual Studio Project and call it “Area”. This project will be used to calculate the area of certain figures, like circles, squares and rectangles. So add a title to the Form. The Form Title should say “Area”. Also add 3 labels, 3 Buttons, 3 Textboxes and 3 RadioButtons. The 3 Buttons should be near the bottom of the Form and say “Calc Area”, “Clear” and “Exit”. Make sure to give all your...
Create a Visual Studio console project (c++) containing a main() program that declares a const int...
Create a Visual Studio console project (c++) containing a main() program that declares a const int NUM_VALUES denoting the array size. Then declare an int array with NUM_VALUES entries. Using a for loop, prompt for the values that are stored in the array as follows: "Enter NUM_VALUES integers separated by blanks:" , where NUM_VALUES is replaced with the array size. Then use another for loop to print the array entries in reverse order separated by blanks on a single line...
Create a new website using C# & ASP.Net in Visual Studio: 1. Create a web page...
Create a new website using C# & ASP.Net in Visual Studio: 1. Create a web page to access a database and display the data from a table by providing an SQL statement. Create the page with these requirements:     create label, textbox and button     the textbox will capture the SQL statement     the button will process the statement and display the results 2. Add necessary data access pages to your project. 3. Display the data in Gridview
In Assembly Language (Visual Studio 2017), create a procedure that generates a random string of Length...
In Assembly Language (Visual Studio 2017), create a procedure that generates a random string of Length L, containing all capital letters. When calling the procedure, pass the value of L in EAX, and pass a pointer to an array of byte that will hold the random string. Write a test program that calls your procedure 20 times and displays the strings in the console window. In your program, the random string size shall be preset as a constant. Please include...
USE VISUAL STUDIO/VB In this assignment, you will create an array of ten elements, one for...
USE VISUAL STUDIO/VB In this assignment, you will create an array of ten elements, one for name, one for hours worked,and the last for hourly rate. The arrays will receive the information from inputs from the screen.For example, you will ask the following three questions: a) Employee name: b) Hours worked: c) Hourly rate: After you have received all ten records and have inserted them into the array, you will then calculate the hourly rate times the hours worked to...
In visual Studio C++ Create a program that uses a for loop to input the high...
In visual Studio C++ Create a program that uses a for loop to input the high temperature, and low temperature for each day of the week. The high and low will be placed into two elements of the array. For each loop the high and low will be placed into the next set of elements of the array. After the temps for all seven days have been entered into the array, a for loop will be used to pull out...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT