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
The solid cylinders AB and BC are bonded together at B and are attached to fixed supports at A and C. The modulus of rigidity is
romanna [79]

Answer:

a) 0.697*10³ lb.in

b) 6.352 ksi

Explanation:

a)

For cylinder AB:

Let Length of AB = 12 in

c=\frac{1}{2}d=\frac{1}{2} *1.1=0.55in\\ J=\frac{\pi c^4}{2}=\frac{\pi}{2}0.55^4=0.1437\ in^4\\

\phi_B=\frac{T_{AB}L}{GJ}=\frac{T_{AB}*12}{3.3*10^6*0.1437}  =2.53*10^{-5}T_{AB}

For cylinder BC:

Let Length of BC = 18 in

c=\frac{1}{2}d=\frac{1}{2} *2.2=1.1in\\ J=\frac{\pi c^4}{2}=\frac{\pi}{2}1.1^4=2.2998\ in^4\\

\phi_B=\frac{T_{BC}L}{GJ}=\frac{T_{BC}*18}{5.9*10^6*2.2998}  =1.3266*10^{-6}T_{BC}

2.53*10^{-5}T_{AB}=1.3266*10^{-6}T_{BC}\\T_{BC}=19.0717T_{AB}

T_{AB}+T_{BC}-T=0\\T_{AB}+T_{BC}=T\\T_{AB}+T_{BC}=14*10^3\ lb.in\\but\ T_{BC}=19.0717T_{AB}\\T_{AB}+19.0717T_{AB}=14*10^3\\20.0717T_{AB}=14*10^3\\T_{AB}=0.697*10^3\ lb.in\\T_{BC}=13.302*10^3\ lb.in

b) Maximum shear stress in BC

\tau_{BC}=\frac{T_{BC}}{J}c=13.302*10^3*1.1/2.2998=6.352\ ksi

Maximum shear stress in AB

\tau_{AB}=\frac{T_{AB}}{J}c=0.697*10^3*0.55/0.1437=2.667\ ksi

8 0
4 years ago
A 3.5-m3 rigid tank initially contains air whose density is 2 kg/m3 . The tank is connected to a high-pressure supply line throu
Mumz [18]

Answer:

Explanation:

First, we find the mass of the air originally in the tank.

Density is given as mass divided by volume. It is given as:

Density = \frac{mass}{volume}

Therefore, mass is:

mass = denisty *volume

Density of air = 2 kg/m^3; Volume of the tank =  3.5 m^3

=> Mass = 3.5 * 2 = 7 kg

The mass of the air initially in the tank is 7 kg.

After air is allowed to enter, the mass changes.

New density = 6.5 kg/m^3

The new mass will be:

Mass = 6.5 * 3.5 = 22.75 kg

We can now find the mass of air that has entered the tank:

Mass of air that entered tank = New mass of air - Original mass of air

M = 22.75 - 7.0 = 15.75 kg

The mass of air that entered the tank is 15.75 kg.

6 0
3 years ago
You can assume there is no pressure drop between the exit of the compressor and the entrance of the turbine. All the power from
Eddi Din [679]

Answer:

s6rt5x11j4fgu

j4

cf53yhu5

y4

hh

Explanation:

j

6 0
3 years ago
Just to let you know Christmas is in 10 days&lt;3<br><br> lol
Harrizon [31]

Answer:

yay yay

Explanation:

im so excited i cant wait

7 0
3 years ago
Read 2 more answers
3. Which of these instruments is used to measure wind speed? A. anemometer C. wind sock B. thermometer D. wind vane It is an ins
siniylev [52]

Answer:

wind vane if it can be used to show wind speed and the other is a

Explanation:

please mark 5 star if im right and brainly when ya can

5 0
3 years ago
Other questions:
  • Consider a single crystal of some hypothetical metal that has the BCC crystal structure and is oriented such that a tensile stre
    10·1 answer
  • Calculate the value of ni for gallium arsenide (GaAs) at T = 300 K. The constant B = 3. 56 times 1014 9cm -3 K-3/2) and the band
    9·1 answer
  • Although the viscoelastic response of a polymer can be very complex (time-dependent stress cycling for instance), two special lo
    11·1 answer
  • If a machine uses LESS effort to overcome a given resistance force (if Fe is less than FR), it has an actual mechanical advantag
    13·1 answer
  • Assume the triac of an AC discrete output module fails in the shorted state. How would this affect the device connected to this
    5·1 answer
  • Why Your first project as the new web designer at Smart Design is to increase web traffic to help boost web orders. Before you b
    6·1 answer
  • An Otto cycle with air as the working fluid has a compression ratio of 8.2. Under cold air standard conditions, what is the ther
    14·1 answer
  • True or False; If I was trying to find the Voltage of my computer, and I was given the Watts and Amps it uses, I would use Watt'
    8·1 answer
  • What is the primary difference between the process of lost-wax casting as practiced in ancient times and that same process today
    13·1 answer
  • A type of adjustable square that can be used to set, test, and transfer angles is called a
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!