TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sharad arora
NA
1
1.6k
CONVERTING PSEUDO CODE TO c#
Nov 12 2013 2:55 AM
Beer is produced in 250ml (0.25l) cans and 400ml (0.4l)
bottles. Nilesh remembered you were a genius programmer and
wants you to build an application which allows the him to enter
the number of cans (e.g. 200) and the number of bottles (e.g. 150)
required for an order. It will then work out the amount of beer
needed to fill the cans, the amount of beer needed to fill the
bottles, the number of kegs required and the total cost of the kegs.
The application will display the amount of beer for cans, for
bottles, number of kegs required and total cost of kegs required.
One keg holds 50 litres of beer and the cost of a keg is $95.50.
Your application should have 3 buttons: Calculate Beer
Required, Clear and Exit. Give the buttons appropriate names
and access keys.
The Clear button will clear the input text boxes and all output
values and set the focus to the first input text box. The Exit
button will end the application.
The pseudo-code for the Calculate Beer Required button is:
GET the number of cans ordered
GET the number of bottles ordered
CALCULATE the amount of beer needed to fill the cans
( = number of cans * size of each can)
CALCULATE the amount of beer needed to fill the bottles
( = number of bottles * size of each bottle)
CALCULATE the total amount of beer needed
( = total beer for cans + total beer for bottles)
CALCULATE the number of kegs required (rounded up to a
whole number)
( = total amount of beer / amount of beer in a keg)
CALCULATE the total cost of the kegs required
( = number of kegs * cost of 1 keg)
DISPLAY the amount of beer required for cans (to 3dp)
DISPLAY the amount of beer required for bottles (to 3dp)
DISPLAY the number of kegs required
DISPLAY the total cost of the kegs formatted as currency
Think carefully about the type of control used to display the
values, you don't want the user to be able to change the values.
Note: You can assume the user will type in valid values into each
textbox.
Hint: Use the appropriate data type for the variables and the appropriate Parse
method for the datatype you want to convert to.
Hint: Use Math.Ceiling(value) to round a value up to a whole number.
a) Create the user interface for the application, give each button
appropriate access keys.
b) Create appropriate constants at class scope level.
c) Create the code for the Clear and Exit buttons.
d) Create the code for the Calculate Beer Required button based on
the given pseudo-code.
e) Create a XML style comment header for each click event method
and add comments in the code to explain blocks of code
Reply
Answers (
1
)
Insert "&" sign and select it
MVCR Performance issue