String-classes-constructors and member functions, C/C++ Programming

Objective

Using C++ string, classes, constructors and member functions.

Task A
Write a program (book.cpp) to store a list of book titles and the published dates. Your program is to read in an array of book titles and published dates. The student should declare a class called book with two members: book title and published date.

Your program shall perform the following:
1. Prompt user to enter the book title and the published date.
2. The program should be designed to allow the user to key in 10 entries and they should be stored in an array of structures.
3. A function printbook should be written for the 10 entries of book titles and published dates to be printed out on the screen.
4. Correctly identify invalid user input

Task B

Write a program (room.cpp) to create a room class which allows the user to set the length and width of the room as well as the colour of the room. The user can also display the room's area and colour on the screen.

The program should include the following:
• The room class consists of 3 variables: length, width and colour.
• The room class should have a function area to calculate the room area based on the length and width inputs.
• Two instances or objects: rooma and roomb of the room class should be created.
• Use constructor and destructor for the room class.
• rooma object should be declared and 3 arguments should be passed on. They are: length=5, width=4 and colour=green.
• roomb object was declared without any arguments, which initialised both length and height with a value of 4 and colour=white.
• The program should print out the area and colour of the objects (rooma and roomb).

Posted Date: 2/23/2013 2:43:29 AM | Location : United States







Related Discussions:- String-classes-constructors and member functions, Assignment Help, Ask Question on String-classes-constructors and member functions, Get Answer, Expert's Help, String-classes-constructors and member functions Discussions

Write discussion on String-classes-constructors and member functions
Your posts are moderated
Related Questions
#write a program that counts the number of occurances of the string in the n-th padovan string p(n)

Incomplete types refer to pointers in which there is no availability of the execution of the referenced location or it points to some location whose value is not available for modi

In this assignment, you will develop a program named "match" to be used by a dating service to form couples. Given the number of gentlemen, the number of ladies, and a list of acce

#questAt a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets wit

Produce data from fixed OCR areas scanned. Project Description: Project is to design software which can use character recognition only on certain areas of scanned puff's/ jpe

how to use and what is implicit and explicit constructor

Dynamic Initialization of objects: It is initializing the objects by passing the valued to the constructor from the user input or other means.   Through cin operator a value

I want VLC Pitch Changing Addon Project Description: Required: Plugin to modify the pitch of running tracks in VLC without changing the speed. Skills required are C Progra

An employee’s total weekly pay equals the hourly wage multiplied by the total number of regular hours plus any overtime pay. Overtime pay equals the total overtime hours multiplied

#padovan string   program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : package test.padovanstring; public class PadovanString {