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]
3 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]3 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 cylindrical brass rod has a length of 5.00cm extending from a holder and a diameter of 4.50mm. Its Young's modulus is 98.0GPa.
Galina-37 [17]

Answer:

elongation of the brass rod is 0.01956 mm

Explanation:

given data

length = 5 cm = 50 mm

diameter = 4.50 mm

Young's modulus = 98.0 GPa

load = 610 N

to find out

what will be the elongation of the brass rod in mm

solution

we know here change in length formula that is express as

δ = \frac{PL}{AE}    ................1

here δ is change in length and P is applied load  and A id cross section area and E is Young's modulus and L is length

so all value in equation 1

δ = \frac{PL}{AE}  

δ = \frac{610*50}{\frac{\pi}{4} * 4.50^2 * 98*10^3}  

δ = 0.01956 mm

so elongation of the brass rod is 0.01956 mm

7 0
3 years ago
Martha has been running a small business for two years. She now seeks additional investment to finance her business. She has fou
Dafna11 [192]

Answer:

The correct option is B) Balance Sheet

Explanation:

A Balance Sheet offers a description of a company's obligations, assets, and investments as well as net income over a given span of time such as a period of 6 months or 12 months, for instance.

Also known as the Statement of Financial Position, it contains sufficient information for investors and business owners to determine the company's financial performance in that period as well as to compare the performance of that company with industry norms or competition.

Cheers

8 0
2 years ago
For this given problem, if the yield strength is now 45 ksi, using Distortion Energy Theory the material will _______ and using
serious [3.7K]

Answer:

Option A - fail/ not fail

Explanation:

For this given problem, if the yield strength is now 45 ksi, using Distortion Energy Theory the material will _fail______ and using the Maximum Shear Stress Theory the material will ___not fail_______

6 0
3 years ago
The heat required to raise the temperature of m (kg) of a liquid from T1 to T2 at constant pressure is Z T2CpT dT (1) In high sc
a_sh-v [17]

Answer:

(a)

<em>d</em>Q = m<em>d</em>q

<em>d</em>q = C_p<em>d</em>T

q = \int\limits^{T_2}_{T_1} {C_p} \, dT   = C_p (T₂ - T₁)

From the above equations, the underlying assumption is that  C_p remains constant with change in temperature.

(b)

Given;

V = 2L

T₁ = 300 K

Q₁ = 16.73 KJ    ,   Q₂ = 6.14 KJ

ΔT = 3.10 K       ,   ΔT₂ = 3.10 K  for calorimeter

Let C_{cal} be heat constant of calorimeter

Q₂ = C_{cal} ΔT

Heat absorbed by n-C₆H₁₄ = Q₁ - Q₂

Q₁ - Q₂ = m C_p ΔT

number of moles of n-C₆H₁₄, n = m/M

ρ = 650 kg/m³  at 300 K

M = 86.178 g/mol

m = ρv = 650 (2x10⁻³) = 1.3 kg

n = m/M => 1.3 / 0.086178 = 15.085 moles

Q₁ - Q₂ = m C_p' ΔT

C_p = (16.73 - 6.14) / (15.085 x 3.10)

C_p = 0.22646 KJ mol⁻¹ k⁻¹

6 0
2 years ago
Write the heat equation for each of the following cases:
jok3333 [9.3K]

Answer:

Explanation:

a) the steady-state, 1-D incompressible and no energy generation equation can be expressed as follows:

\dfrac{\partial^2T}{\partial x^2}=  \ 0  \  ;  \ if \  T = f(x)  \\ \\ \dfrac{\partial^2T}{\partial y^2}=  \ 0  \  ;  \ if \  T = f(y)  \\ \\ \dfrac{\partial^2T}{\partial z^2}=  \ 0  \  ;  \ if \  T = f(z)

b) For a transient, 1-D, constant with energy generation

suppose T = f(x)

Then; the equation can be expressed as:

\dfrac{\partial^2T}{\partial x^2} + \dfrac{Q_g}{k} = \dfrac{1}{\alpha} \dfrac{dT}{dC}

where;

Q_g = heat generated per unit volume

\alpha = Thermal diffusivity

c) The heat equation for a cylinder steady-state with 2-D constant and no compressible energy generation is:

\dfrac{1}{r}\times \dfrac{\partial}{\partial r }( r* \dfrac{\partial \ T }{\partial \ r}) + \dfrac{\partial^2 T}{\partial z^2 }= 0

where;

The radial directional term = \dfrac{1}{r}\times \dfrac{\partial}{\partial r }( r* \dfrac{\partial \ T }{\partial \ r}) and the axial directional term is \dfrac{\partial^2 T}{\partial z^2 }

d) The heat equation for a wire going through a furnace is:

\dfrac{\partial ^2 T}{\partial z^2} = \dfrac{1}{\alpha}\Big [\dfrac{\partial ^2 T}{\partial ^2 t}+ V_z \dfrac{\partial ^2T}{\partial ^2z} \Big ]

since;

the steady-state is zero, Then:

\dfrac{\partial ^2 T}{\partial z^2} = \dfrac{1}{\alpha}\Big [ V_z \dfrac{\partial ^2T}{\partial ^2z} \Big ]'

e) The heat equation for a sphere that is transient, 1-D, and incompressible with energy generation is:

\dfrac{1}{r} \times \dfrac{\partial}{\partial r} \Big ( r^2 \times \dfrac{\partial T}{\partial r} \Big ) + \dfrac{Q_q}{K} = \dfrac{1}{\alpha}\times \dfrac{\partial T}{\partial t}

4 0
3 years ago
Other questions:
  • A simple ideal Rankine cycle with water as the working fluid operates between the pressure limits of 4 MPa in the boiler and 25
    14·2 answers
  • ANSWER QUICK<br>Why did Winston Churchill take over for Neville Chamberlain shortly after ww2? ​
    9·1 answer
  • Define the Problem
    11·1 answer
  • a) Give a brief description of the type of DC motor that operates with its field windings running in Series with the armature an
    10·1 answer
  • The steel 4140 steel contains 0.4% C, however, it shows higher yield strength and ultimate strength than that of the 1045 (0.45%
    14·1 answer
  • 2. When it comes to selling their crop, what are 3 options a farmer has when harvesting their grain?
    5·1 answer
  • An undeformed specimen of some alloy has an average grain diameter of 0.050 mm. You are asked to reduce its average grain diamet
    11·1 answer
  • Select the correct answer.
    15·2 answers
  • Concrete ___ support and anchor the bottom of steel columns and wood post, which support beams that are pare of framing system o
    11·1 answer
  • Why the power factor is Low in no load test in induction motor ?​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!