Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Need help creating program!!! CAN SOMEONE PLEASE HELP!!
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
kworley00




PostPosted: Sun Feb 05, 2012 7:06 pm   Post subject: Need help creating program!!! CAN SOMEONE PLEASE HELP!!

Program Lab #3

Function Basics

You have been asked to construct a program that will draw rectangular fences and compute the area they enclose.
You will need to prompt the user for a width and a height value and then draw the rectangular fence on the screen
with the dimensions they specify. You should compute and display the enclosed area and perimeter of the fence.
Negative values are not allowed, so you should warn the user and prompt them for a new value. Zero is a valid
value, and will cause the enclosed area to also be zero. The fence should be drawn using the plus(+), minus(-),
and pipe(|) characters and enclose blank spaces. It should always draw the four corners(+). It should draw one
horizontal segment(-) for each unit of width and a vertical segment(|) for each unit of height.


=================================================================================================================================

Deliverables:
Write a program using good style, indents, descriptive variable names, comments, etc..
Greet the user and provide one line about what the program is/does.
Prompt the user for two values, width and height.
Verify that the values are non-negative and prompt the user for new values as needed.
Draw a rectangle on the screen using +, -, and | to the dimensions entered by the user.
Compute and output to the screen the enclosed area and perimeter of the fence.
Prompt the user to repeat with another fence and accept 'Y' and 'y' as valid responses to repeat.
If the user does not wish to continue, exit the program with a closing message.


=================================================================================================================================

Construct a function Draw that takes as input the integer width and height and draws the rectangle on the screen.
Construct a function Area that takes as input the integer width and height, computes the area, and displays it on the screen.

=================================================================================================================================


Example Output:
----- Fence-o-matic -----
This program will draw and compute the area of a fence that you specify.

Please enter a width: 4
Please enter a height: 3

+----+
| |
| |
| |
+----+
Area = 12 Perimeter = 14

Would you like another fence? Y

Please enter a width: 1
Please enter a height: 1

+-+
| |
+-+
Area = 1 Perimeter = 4

Would you like another fence? y

Please enter a width: 2
Please enter a height: 0

+--+
+--+
Area = 0 Perimeter = 4

Would you like another fence? Y

Please enter a width: -2
Negative numbers are not allowed!
Please enter a width: 4
Please enter a height: -3
Negative numbers are not allowed!
Please enter a height: 1

+----+
| |
+----+
Area = 4 Perimeter = 10

Would you like another fence? N

Thank you for using Fence-o-matic, GoodBye!
Sponsor
Sponsor
Sponsor
sponsor
md




PostPosted: Sun Feb 05, 2012 7:50 pm   Post subject: RE:Need help creating program!!! CAN SOMEONE PLEASE HELP!!

If you've tried and gotten stuck then post what you have, otherwise do your own homework.
Velocity




PostPosted: Mon Feb 06, 2012 1:08 am   Post subject: RE:Need help creating program!!! CAN SOMEONE PLEASE HELP!!

i dont get it... Are you trying to prove something, where's your problem?
mirhagk




PostPosted: Mon Feb 06, 2012 7:42 am   Post subject: RE:Need help creating program!!! CAN SOMEONE PLEASE HELP!!

He's trying to get us to write the answer for him.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: