Thursday, October 8, 2009

C++ Assignment

Section A: Complete question 1 in Section A. 
1. Write a program that includes the following four steps:
Step 1.Create a structure with the name StudentRecord containing a Name stored as an array of 20 characters, an ID stored as an integer, and a GPA stored as a floating-point number. Create (instantiate) a variable from StudentRecord called TESCStudent.

Step 2. Assign the following values to the variable by assuming Name is SuperProgrammer, with an ID of 1234, and a GPA of 4.0.

Step 3. The program should print out on the screen that SuperProgrammer with an Identification number of 1234 has a 4.0 GPA. (Of course, your program needs to use the structure you defined in step 1.)

Step 4. Generalize the program so that you can input the student's name, ID, and GPA when the program is run. Please do not forget to include prompt statements in your program. Print out the user entered Name, ID, and GPA. 

Make sure your program includes all four steps, not just steps 1 and 4.

Section B: Complete either question 1 or 2 in Section B. 
1. Define a class called Plot that has private members of length and width. Include a constructor and a public function that calculates the area and the length of the boundary of the field. Use public functions in a program that computes and displays the area and the length of the boundary of the plot where the length and width are 7 and 9 respectively. Hint: The length of the boundary is 2 * (length + width).
2. Recode the Plot class from question 1 above, using inline methods.
Remember that when you submit this assignment, you should acknowledge to your mentor that you have reviewed all programs using a C++ compiler.
When you are ready to submit your assignment, click the View/Complete Assignment link at the bottom of this page, and then use the Browse button to locate and submit your assignment file. Consult the course Calendar for the assignment's due date.

No comments:

Post a Comment