1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sertanlavr [38]
4 years ago
6

LAB 3.3 – Working with String Input and Type CastingStep 1: RemovefindErrors.cppfrom the project and add thepercentage.cppprogra

m in yourLab3 folder to the project. Here is a copy of the source code.1 // Lab 3 percentage.cpp2 // This program will determine the percentage3 // of answers a student got correct on a test.4 // PUT YOUR NAME HERE.56 // INCLUDE THE FILE NEEDED TO DO I/O7 // INCLUDE THE FILE NEEDED TO FORMAT OUTPUT8 // INCLUDE THE FILE NEEDED TO USE STRINGS9 using namespace std;1011 int main()12 {13string name;14int numQuestions,15numCorrect;16double percentage;1718// Get student's test data19cout << "Enter student's first and last name: ";20// WRITE A STATEMENT TO READ THE WHOLE NAME INTO THE name VARIABLE.2122cout << "Number of questions on the test: ";23cin >> numQuestions;24cout << "Number of answers the student got correct: ";25cin >> numCorrect;2627// Compute and display the student's % correct28// WRITE A STATEMENT TO COMPUTE THE % AND ASSIGN THE RESULT TO percentage.2930// WRITE STATEMENTS TO DISPLAY THE STUDENT'S NAME AND THEIR TEST31// PERCENTAGE WITH ONE DECIMAL POINT.3233return 0;34 }Step 2: Replace each capitalized comment with C++ code that does what the comment asks you to do.Then compile and run the program. Here is what a sample run should look like:Sample RunEnter student's first and last name: John SmithNumber of questions on the test: 40Number of answers the student got correct: 31John Smith77.5%
Engineering
1 answer:
jolli1 [7]4 years ago
4 0

Answer:

// Program is written in C++ Programming Language

// Comments are used for explanatory purpose

#include<iostream>

using namespace std;

int main ()

{

// Variable declaration

string name;

int numQuestions;

int numCorrect;

double percentage;

//Prompt to enter student's first and last name

cout<<"Enter student's first and last name";

cin>>name; // this line accepts input for variable name

cout<<"Number of question on test"; //Prompt to enter number of questions on test

cin>> numQuestions; //This line accepts Input for Variable numQuestions

cout<<"Number of answers student got correct: "; // Prompt to enter number of correct answers

cin>>numCorrect; //Enter number of correct answers

percentage = numCorrect * 100 / numQuestions; // calculate percentage

cout<<name<<" "<<percentage<<"%"; // print

return 0;

}

Explanation:

The code above calculates the percentage of a student's score in a certain test.

The code is extracted from the Question and completed after extraction.

It's written in C++ programming language

You might be interested in
A technician needs to check the heating operation of a heat pump that has no gauge access ports. The technician should start by:
OverLord2011 [107]

The technician should start by checking the temperature rise across the indoor coil.

<h3>Who is a technician?</h3>

This is a person who has skill in a particular area of job. A technician is responsible for repairs and also ensure different equipment and systems are working perfectly.

Hence, the technician should start by checking the temperature rise across the indoor coil.

Learn more about technician here : brainly.com/question/13315405

#SPJ1

7 0
2 years ago
What are the basic parts of a radio system
Romashka-Z-Leto [24]
Today's radio consists of an antenna, printed circuit board, resistors, capacitors, coils and transformers, transistors, integrated circuits, and a speaker. All of these parts are housed in a plastic case. An internal antenna consists of small-diameter insulated copper wire wound around a ferrite core.
4 0
4 years ago
Which statement most accurately describes Pascal's law?
marin [14]

Answer:

La  C

Explanation:

7 0
3 years ago
Read 2 more answers
An electrical current of 700 A flows through a stainlesssteel cable having a diameter of 5 mm and an electricalresistance of 610
KatRina [158]

Answer:

778.4°C

Explanation:

I = 700

R = 6x10⁻⁴

we first calculate the rate of heat that is being transferred by the current

q = I²R

q = 700²(6x10⁻⁴)

= 490000x0.0006

= 294 W/M

we calculate the surface temperature

Ts = T∞ + \frac{q}{h\pi Di}

Ts = 30+\frac{294}{25*\frac{22}{7}*\frac{5}{1000}  }

Ts=30+\frac{294}{0.3928} \\

Ts =30+748.4\\Ts = 778.4

The surface temperature is therefore 778.4°C if the cable is bare

6 0
3 years ago
Each cout statement has a syntax error. Type the first cout statement, and press Run to observe the error message. Fix the error
saul85 [17]

Answer:

1. cout << "Num: " << songNum << endl;

2. cout << songNum << endl;

3. cout << songNum <<" songs" << endl;

Explanation:

//Full Code

#include <iostream>

using namespace std;

int main ()

{

int songNum;

songNum = 5;

cout << "Num: " << songNum << endl;

cout << songNum << endl;

cout << songNum <<" songs" << endl;

return 0;

}

1. The error in the first cout statement is that variable songnum is not declared.

C++ is a case sensitive programme language; it treats upper case and lower case characters differently.

Variable songNum was declared; not songnum.

2. Cout us used to print a Variable that has already been declared.

The error arises in int songNum in the second cout statement.

3. When printing more than one variables or values, they must be separated with <<

4 0
3 years ago
Other questions:
  • Refrigerant-134a enters a diffuser steadily as saturated vapor at 600 kPa with a velocity of 160 m/s, and it leaves at 700 kPa a
    10·2 answers
  • Block A is released from rest and slides down the frictionless ramp to the loop. The maximum height h of the loop is the same as
    6·1 answer
  • Wiring harnesses run
    12·1 answer
  • A cylindrical tank with a radius of 2-m is filled with oil and water. The water has a density of rho = 1000 kg/m3 while the oil
    6·1 answer
  • Both equilibrium equations and constitutive models are needed to solve statically indeterminate problems. a)- True b)-False
    13·1 answer
  • Convert 103.69 kN to TN.
    14·1 answer
  • PLS :(((( HELP HELPPPP
    13·1 answer
  • HELP _7. All of the following except which would lead to an INCREASE in friction?
    15·1 answer
  • Compare and contrast mechanical properties of plastics, metals and ceramics.
    13·1 answer
  • Airbags may deploy in the<br> of the passenger or<br> driver, or from the<br> of the vehicle.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!