Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For each of the pieces of data in the following table, write the C++ statement t

ID: 3870333 • Letter: F

Question

For each of the pieces of data in the following table, write the C++ statement to declare and/or initialize it. Use an appropriate self-documenting name for the variable or constant, and follow our capitalization conventions. See the second line of the table for an example: [8 Points]

Data Item

C++ declaration statement

The math constant pi

const double PI=3.1415926535;

The weight of a shipment of wood, in kg.

Your name.

The number of feet per mile.

The number of people who live in your residence.

3) Find at least 3 syntax errors in the following program. Circle each error’s location, and write a few words describing the error, next to your circle: [8 Points]

// Silly test example program with syntax errors

#include <iostream>

using namespace std;

int main{}

(

cout << "How old are you ? "; int years; cin >> years;

double total = years * 12;

cot << " Months of age = " << total << endl;

total += 12;

return 0;

};

4) Letter Grade: Write a C++ program which will prompt a user to enter a test score, which may be a floating point number. It should print out the following outputs, depending on the user input:

[18 Points]

Output Input Range

"Invalid score" <0

"Invalid input" non-numeric value

F 0 <= input < 60

D 60<= input < 70

C 70<= input < 80

B 80<= input < 90

A 90<= input <100

A+ 100<input

The screen dialog should look something like (where user input is shown in underlined italics):

Test Grading Program.

Enter a numeric score: 50.5

The grade for a 50.5 is F.

5) Write a program to ask the user for 3 college names. It should print them back out in alphabetically sorted order, one per line. The names will consist of multiple words, including white space.

[18 Points]


Enter names of 3 schools:

Purdue University

Ivy Tech Community College

Indiana State University

Alphabetically, they are

Indiana State University

Ivy Tech Community College

Purdue University

_

Data Item

C++ declaration statement

The math constant pi

const double PI=3.1415926535;

The weight of a shipment of wood, in kg.

Your name.

The number of feet per mile.

The number of people who live in your residence.

Explanation / Answer

I have answered first two questions.Please repost others in separate post.

Q2)

double weightOfShipment = 67.5;

string myName = "Pravesh Kumar";

const int feetPerMile = 5280;

int numberOfPeople = 300;

Q3)

first error: main function defination. it should be () brancket instead of

{}.

int main{}() => int main(){}

second error: it should be "cout"

cot<<" Months of age="<<total<<endl;

correct: cout<<" Months of age="<<total<<endl;

third error: there should be not ";" after main function

}; => }