Lab1(2) - CS 172 Computer Programming II Spring 2016 Lab 1...

This preview shows page 1 - 4 out of 14 pages.

CS 172 Computer Programming IISpring 2016Lab 1 – Classes and Multi-File ProgramsQuestion 1: At the beginning of every lab you should be in your lab group. Unless some issue arises we will allow you to choose your own groups. Group sizes should be in the range of 2-4 students. Every student is in charge of populating their own answer sheet with the answers determined by the group.On your lab sheet, record the names of your group members (including yourself!!!).Question 2: Let’s start off thinking about object-oriented design. Recall that an objectcan have properties(or attributes) and can have methods(which perform actionsConsider the string class. Using either your textbook and/or online resources, list below a few properties (attributes) of strings as well as methods of the string class. For each property, give asample value.).Answer: Attributes: Methods:string name_;namefind();char;hrfind();length(); 10substr();c_str();setwidth();
Question 3 Imagine an object used to represent Students in a Drexel database. What attributes and methods do you think these Student objects should have?
Question 4 For the next few questions of the lab, you will modify a program.
You will use a pre-defined class called DUPointwhose declaration and definition are to be stored in separate files. You will also work with a pre-defined class called DULineand a main program which uses these classes.The DUPointand DULine classes used in this lab are similar to but different from the Pointand Linestructures used by Horstmann's "ccc_win" graphics package, and so are named differently.Download the following files for the lab:testDUPoint.cppDULine.h DULine.cppStart up a new project (Visual Studio or XCode)Add testDUPoint.cppto the project. The other files will be used later; do not add them to the project now. Examine the testDUPoint.cppfile. In addition to the types of code we have seen before, this file contains a class declaration (header)and a class definitionBelow, record the name of the class..

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture