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
Think about all the things we have investigated in class so far this semester. Identify three examples of climate-related aspect
Free_Kalibri [48]

Answer:

1) the mean surface temperature of earth.

2) precipitation and sunshine

3) air and wind movement.

6 0
3 years ago
Which sentence with an introductory phrase is punctuated correctly?
viktelen [127]
WHERE R THE SENTENCES
3 0
2 years ago
Problem a) – c): Use the method of joints, the method of sections, or both to solve the following trusses. Draw F.B.Ds for all y
Ghella [55]

Answer:

This is confusing sorry

Explanation:

7 0
3 years ago
ferry boat steamed along at 8 mph through calm seas, passenger casey exercised by walking the perimeter of the rectangular deck,
olga_2 [115]
Tell me why i got this question got it right and now won’t remember but i’ll get back at you when i remember
6 0
3 years ago
Of the children who die in car crashes, how many of them die due to an improper restraint system (or even just not being buckled
Lina20 [59]

Answer:

you died

Explanation:

8 0
3 years ago
Other questions:
  • A concrete mix design calls for 6.5 sacks of cement, a water/cement ratio of 0.45, and an air content of 2.5%. 1. Complete the m
    13·2 answers
  • Saturated water with a quality of 0.55 and a temperature of 120 oC enters an uninsulated diffuser at a velocity of 180 m/s. The
    9·1 answer
  • Guys, can you rate this toolbox, please. It is my DT project, made for car trips, what do you think of the idea/design/usability
    12·1 answer
  • A 2.15-m3 rigid tank initially contains air whose density is 1.18 kg/m3. The tank is connected to a high-pressure supply line th
    12·2 answers
  • A local surf report provides the height of the wave from the trough to the crest of the wave. How does this relate to the wave’s
    11·1 answer
  • What is the function of the work clamp during shielded metal arc welding?
    7·1 answer
  • Calculate the reflection loss that is incident normal to the surface of a triple pane window (assume n for window glass is 1.5)
    7·1 answer
  • Whats the thing in the picture? Its a part of a computer.
    14·2 answers
  • What Forces are involved with roller coasters?
    12·2 answers
  • Based on its atomic number, how many electrons does a hydrogen atom have
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!