Project #49641 - C++ Assignment

1. Write a program in C++ to ask the user to input a set of characters, one at a time separated by the carriage return (Enter). Each character, as well as, its corresponding ASCII value should be stored in a linked list node. This means that each node in the linked list should have 3 parts; (1) char that stores the input of the user, (2) int that stores the ASCII value of the character and (3), a pointer to its successor node. When the user inputs the character 0 (zero), the program should break the loop, prints each character with its ASCII value on a separate line, then exits. You can implement the node as struct or class. Please note that the ASCII code of any character can be retrieved by casting its integer value. 

2. Consider the following requirements:

a. Class Vehicle

 Variables

o weight of type float, initial value is zero

 Functions

o print() abstract function of type void

b. class Truck inherits from Vehicle

The class Truck is not abstract

c. class Engine

 Functions

o start() of type void. It should print “engine started”

o stop() of type void. It should print “engine stopped”

d. class Tire

 Variables

o pressure of type integer, initial value is 30

 Functions

o inflate() of type integer that takes one integer argument called psi. This function will

add the value of psi to pressure and then it returns the new pressure of the tire

e. class Window

 Functions

o rollup() of type void. It should print “window is up”

o rolldown() of type void. It should print “window is down”

f. class Door

 Variables

o window of type Window

 Functions

o open() of type void. It should print “door is open”

o close() of type void. It should print “door is close”

g. class Car inherits from Vehicle

 Variables

o engine of type Engine

o tire, an array of 4 tires, of type Tire

o left of type Door

 

Write a program in C++ to implement the above requirements.

Subject Computer
Due By (Pacific Time) 12/02/2014 10:00 am
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy