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

Read these directions completely and carefully before you start. The steps canno

ID: 3556354 • Letter: R

Question

Read these directions completely and carefully before you start. The steps cannot be correctly completed in the order listed, so you may want to pseudocode the program first. Include appropriate comments.

1. Create a string array and add the following names:

Boney, Sam

Inovera, Marge

Moore, Bruno

Steem, Lois

First, Hugo

2. Display the names in the array, one per line

3. Sort that array into alphabetical order by last name

4. Display the names in the array, one per line

5. Create a second string array; using your imagination to match the following jobs with the names in step 2 and place the job names into the new array in the same order as the sorted name array

Bungi jumping instructor

Caffeine addiction counselor

Statistician

Assertiveness training coordinator

Ice rink manager

6. Display the job array, one per line

7. Display the names and their corresponding jobs, separated by 5 space, one name and job per line.

8. Create a class called Student represented by the following UML:

Student

-lastname: string
-firstname: string
-grade: string

-job: string
-percentage: float

+calcGrade()

9. Create the appropriate constructor, getters and setters for the class.

10. Create an instance of Student for each of the students listed above from array. Construct the instance with lastname, firstname, and job.

11. Ask the user to input a percentage (in the range 00.00 to 100.00) for each student. Store the percentage in the class instance.

12. Create the calcGrade function to generate a letter grade from the percentage for each student according to the grading stand below. Store the grade in the class instance.

A

93

Student

-lastname: string
-firstname: string
-grade: string

-job: string
-percentage: float

+calcGrade()

Explanation / Answer

Program Code:

#include<string>
#include<iostream>
using namespace std;

int main()
{
   string wrk[]={"Bungi jumping instructor","Caffeine addiction counselor","Statistician","Assertiveness training coordinator","Ice rink manager"};
   string str[]={"Boney,Sam", "Inovera,Marge", "Moore,Bruno", "Steem,Lois", "First,Hugo"};
   for(int i=0;i<sizeof(str);i++)
   {
       cout<<str[i]<<endl;
   }
   for(int i=0;i<sizeof(wrk);i++)
   {
       cout<<wrk[i]<<endl;
   }
   for(int i=0;i<sizeof(str);i++)
   {
       cout<<str[i]<<" works as "<<wrk[i]<<endl;
   }
   system("pause");
   return 0;
}