Lab Session-5 CSIT221 Fall 2002 - PowerPoint PPT Presentation

About This Presentation
Title:

Lab Session-5 CSIT221 Fall 2002

Description:

(Refer to the program developed for lab4) ... 'Please enter the price of item1' 23.45; 'Please enter the price of item2' 45.66; (continued) ... – PowerPoint PPT presentation

Number of Views:12
Avg rating:3.0/5.0
Slides: 4
Provided by: sunyfr
Category:
Tags: csit221 | fall | item1 | lab | session

less

Transcript and Presenter's Notes

Title: Lab Session-5 CSIT221 Fall 2002


1
Lab Session-5 CSIT221 Fall 2002
  • Using default and parameterized constructors with
    classes and choosing a constructor.

2
Lab Exercise (Demo Due Oct 1st Sec 01 and Oct
3rd Sec 02)
  • (Refer to the program developed for lab4). The
    cash register class should now contain two
    constructors. The default constructor should
    initialize the length of the price list to zero
    and all the prices to zero. The parameterized
    constructor invokes user interaction. The
    parameter passed is the length of the list. The
    constructor then initializes prices of all the
    items in the list through user interaction. User
    interaction examples are on the next slide.

3
User Interaction Examples
  • Source program example
  • Cash_reg Qmart(9)
  • Parameterized constructor interaction
  • Welcome to Qmart
  • There are 9 items in the price list
  • Please enter the price of item1
  • 23.45
  • Please enter the price of item2
  • 45.66
  • (continued)
Write a Comment
User Comments (0)
About PowerShow.com