Unformatted text preview:

CSE2341 EXAM 1 Review I Use the following class description to answer the questions below 20 points class Person private char name int age public Person int char int getage return age 1 Write an appropriate constructor that initializes name and age to specific values passed to the constructor 2 Write an appropriate copy constructor 3 Write a main driver that will declare an appropriate correct object of type Person and then display the person s age you should write no more than 12 lines of code II Using the above class write two lines of codes that would be placed in main that show an access violation 10 points III What does the following main driver display 20 points class String private char s int length public String char bool func1 char func2 void String add char p char temptr temptr s length strlen p s new char length 1 strcpy s temptr strcat s strcat s p cout s delete temptr void String func2 for int I length 1 I 0 I cout s I String String char p length strlen p s new char length 1 strcpy s p cout s main String s1 apples s1 func2 s1 add oranges ANSWER III Write just the interface DO NOT CODE ANY OF THE IMPLEMENTATION for the following class SALES that contains the following data members and member functions 20 points pointer to a character for the company s name array of integers capable of containing 4 quarterly sales amounts for 6 divisions of the company a constructor that initializes the name of the company and the array to zeroes bonus function that displays the division number with the highest total sales along with the amount of the highest sales Just show what the interface would look like do not code ANY functions The following main driver should be able to use your class properly main SALES s Sales Inc cin s cout s s bonus


View Full Document

SMU CSE 2341 - Exam Review

Loading Unlocking...
Login

Join to view Exam Review and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Exam Review and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?