Posts Tagged ‘Three Steps’

C++ Experts q5 – void FUNCTIONS WITH DIFFERENT TYPES AND NUMBERS OF PARAMETERS (another long one people :/ )?

Thursday, September 9th, 2010

QUESTION 5: void FUNCTIONS WITH DIFFERENT TYPES AND NUMBERS OF PARAMETERS
Poppy is the manager of VeryVeryNiceCakes home industry that specialises in cakes. She gives two quotations to
every customer that places an order: one for delivering and the other for pick-up by the customer. The quotations
also depend on the sort of cake and the number of cakes. You have to write a C++ program to help Poppy with this.
The program is developed in three steps. You have to submit printouts for 5c only.
Question 5a: Two reference parameters
Write a void function inputAndValidate where the detail of one order are input and validated. The function
should have two reference parameters, namely a parameter storing the sort of cake and a parameter storing the
number of cakes. The sort has to be one of the following: chocolate, carrot, custard, fruit or coffee.
This parameter is thus of type string. The second parameter is of type int.
The first parameter has to be validated by using a do..while loop: the program should keep on displaying a
prompting message until the user enters one of chocolate, carrot, custard, fruit or coffee.
We give the main function below. Test your program to make sure that it works correctly but do not submit any
printouts.
// Assignment 2 Question 5a
#include
#include
using namespace std;
/
/ The required function inputAndValidate should be inserted here.
i
nt main( )
{
string sort;
int number;

inputAndValidate(sort, number);
cout << number << " " << sort << " cake(s). " << endl;
return 0;
}
Question 5b: Two value parameters and two reference parameters
The amounts are calculated as follows:
R80 for one fruit cake and R35 per cake for the other sorts of cake,
R100 delivery fee for the complete order if fewer than 10 cakes are ordered,
R8 per cake delivery fee if 10 or more cakes are ordered.
Now write a void function calculateAmounts that calculates two amounts – one amount that is due if the
client should pick up the order at the shop and another amount that is due if the order should be delivered. This
function has two value parameters supplying the sort of cake and the number of cakes to the function. Furthermore,
there are two reference parameters, namely the two amounts that should be calculated and be available to the main
function.
We give the main function below. You will see that we declare several global constants. You should use them in the
function that you write. Test your program but do not submit any printouts.
// Assignment 2 Question 5b
#include
#include
using namespace std;
c
onst int BASIC_PRICE = 35;
const int FRUIT_PRICE = 80;
const int DELIVER_1 = 100;
const int DELIVER_2 = 8;
/
/ The required functions inputAndValidate and calculateAmounts
// should be inserted here.
i
nt main( )
{
string sort;
int number, amountSelf, amountDeliver;
inputAndValidate(sort, number);
calculateAmounts(sort, number, amountSelf, amountDeliver);
cout << “If customer picks up the order: R ”
<< amountSelf << endl;
cout << “If order should be delivered: R ”
<< amountDeliver << endl;
return 0;
}

Question 5c: Final version
Declare another global constant NR_ORDERS and assign the value 7 to it. Now write a new main function
containing a for loop going from 1 to NR_ORDERS. The two functions written in 5a and 5b should be called inside
the loop and the two amounts should be displayed every time.
Run your program on the data below and submit printouts of the program and output.
chocolate
11
fruit
1
custart
custard
8
carrot
10
coffee
6
coffee
2
chocolate
9

Your Wedding Cake – Make It Special

Friday, March 5th, 2010

Your wedding cake will be the centerpiece of attention at the reception. There will be many pictures taken during the cake cutting and it will also be the last item on the menu that your guests will eat. Learn how to make sure you have a memorable cake by following these three steps.

Step 1: Pick the right baker

Wedding cakes tend to be in two categories. They tend to either look beautiful, but do not taste that good, or are not that beautiful, but are delicious. Pick an experienced baker who is capable of making sure your cake is both beautiful and tastes fantastic. It may cost a little more, but may be worth the expensive.

Step 2. Decide on the color, type, frosting and shape

Color. The color of the cake should coordinate with the color of and theme of your wedding. Determine the style of your wedding. Try to make it more traditional if the wedding is formal and be bolder with the ideas if it is a semi-formal or casual affaire. Also consider the season of your wedding. Let your personality shine through on the choices you make by coordinating your wedding colors and theme into the cake.

Type. Wedding cakes are no longer just the traditional yellow or white sponge cakes. They can be anything from cheese cakes to carrot cakes, coffee cakes, chocolate cakes, mouse cakes, ice-cream cakes, and angel food cakes – anything to your liking:

Frosting. These are three basic types of frostings: butter cream, whip cream and fondant:

Butter cream. Butter cream has a buttery flavor and is not too sweet. It needs to be refrigerated until a few hours before cake cutting, otherwise it’ll melt. It’s the least expensive option. Whip cream. Whip cream is very delicate and will not hold up in higher temperatures. Like butter cream, the cake will need to be refrigerated. The decorating options are limited because it has a much lighter texture. Fondant. Fondant is flat and smooth and doesn’t need to be refrigerated. It doesn’t really taste good and is hard to cut, but it looks great and, unlike butter cream, will let you put all kinds of decorations on the surface.

Shape. Cakes usually are either round or square in shape as these are the easiest to cut and have served. However, if you have a hearts theme in your wedding, think about incorporating that theme across into the shape of the cake. There are many unique shapes that can be created by an experienced baker.

Step 3. Don’t be afraid to be creative

Instead of a traditional wedding cake, which often costs $2.50 to $20 per serving, you can consider serving cupcakes, which has become popular. Or, alternatively, you can serve cakes of different flavors and designs at each of the individual reception table. The guests will have fun cutting and serving themselves the cakes and comparing flavors to each other.

Jennifer Moy

Jennifer Moy is a wedding consultant, planner and author. She provides recommendations on ceremonies, receptions and other aspects of weddings. She is a co-founder of Bright Wedding Ideas, the site focused on providing unique wedding ideas: http://www.brightweddingideas.com