Write code to implement constructor, assessors and mutator, C/C++ Programming

Study the following  class diagram, additional information  and answer  the  questions that follow:

MovieTicket

movieName: string

TicketPrice: double

TicketsSold: int

donation[100]: double 

totalCnt: int

MovieTicket();

getName():string

getTicketPrice():double

getnoOfTicketsSold():int

setName(string): void

setTicketPrice(double): void

setnoOfTicketsSold(int): void

computeDonation(int): void

writeFile():void

Additional Information:  

MovieTicket is a class written to fulfil the requirements of making 100 donations to charity from the ticket sales.  The donation is derived from 10% of the ticket sales. The donations are written to a file.

(a)  Write the class specification for MovieTicket.  

(b)  Write code to implement the following for MovieTicket:  

(i)  Constructor, Assessors and Mutators

(ii)  computeDonation method

(iii)  writeFile method

(c)  Write a test driver to test ALL the methods written in Part (b).  The program uses a loop  to  repeat 100 times to obtain input (movie name, tickets sold and ticket price) from user and invokes the respective methods to set the values and computes the donation. After the loop, the    contents of donation array are written to a file using the writeFile method. Include a screen output in your submission.

Posted Date: 3/23/2013 6:24:52 AM | Location : United States







Related Discussions:- Write code to implement constructor, assessors and mutator, Assignment Help, Ask Question on Write code to implement constructor, assessors and mutator, Get Answer, Expert's Help, Write code to implement constructor, assessors and mutator Discussions

Write discussion on Write code to implement constructor, assessors and mutator
Your posts are moderated
Related Questions
Write algorithm and program for the conversion of a Tree to a Binary Tree

What happens while a derived-class object is developed & destroyed? A: Space is allocated (on the heap or the stack) for the full object (i.e. adequate space to store the data m

When you are designing a generic class to have or otherwise manage objects of other types, when the format and behavior of those other types are unimportant to their containment or

#include #include using namespace std; class Book { private: string title; int iD; int year_pub; string author; public: string getTitle(); int getId(); int getYear_Pub(); st

Problem #1: plugging the memory leak. When you employ the "normal" new operator, for example Foo* p = new Foo(), the compiler generates some special code to manage the case while t

Operators in C++: All C operators are valid operators in C++ also.  Besides C++ has developed some new operators like Operators and their Expression: 1.      Logical op


Write a program consisting of two functions (plus main). The first function should read in a number and then pass this back to main. This value should then be passed into a secon

Task 1 Demonstrate a Java client and server exchanging one text message in each direction. Task 2 Demonstrate a C client and server exchanging one text message in each

Example of structure: struct item {                 int element;                 node_ptr next; }; typedef node_ptr stack; stack create(void) {