I'm doing an exercise where I have to write a program that will suggest a subscription plan based on the users answers to a series of yes-or-no questions.
the exercise is based on this chart: https://imgur.com/a/AEMw5Ln
my main question is: how can I get C++ to 'tally up' the results and produce a plan?
here's my code so you can see what I've done so far...
// Firstly, Welcome the client!
cout << " Welcome to the Wordpress subsciption sugesstion Tool!" << endl;
cout << " In order to find the right plan for you, we'll need to ask you a series of questions!" << endl;
cout << " Answer the following questions using 'y' or 'n' keys when prompted." << endl;
// secondly, Present the series of questions and prompt the user for input.
cout << 1.) Would you like to utilize free themes? (y/n)" << endl;
cin >> answer;
if(answer = 'y')
{
freeTheme = true;
}
else
{
freeTheme = false;
}
cout << "\t\n 2.) Would you like to customize your themes? (y/n)" << endl;
cin >> answer;
if(answer = 'y')
{
customDesign = true;
}
else
{
customDesign = false;
}
cout << "\t\n 3.) Will you be needing Search Engine Optimization? (y/n)" << endl;
cin >> answer;
if(answer = 'y')
{
seoTools = true;
}
else
{
seoTools = false;
}
cout << "\t\n 4.) Is live support important for you? (y/n)" << endl;
cin >> answer;
if(answer = 'y')
{
liveSupport = true;
}
else
{
liveSupport = false;
}
cout << "\t\n 5.) How much data will you need to host? 3GB, 6GB, 13GB, or unlimited(999GB)?" << endl;
cin >> storageCapacity;
if(storageCapacity = 3)
{
costPerMonth = 0.00;
}
else if (storageCapacity = 6)
{
costPerMonth = 5.00;
}
else if (storageCapacity = 13)
{
costPerMonth = 8.00;
}
else if (storageCapacity = 999)
{
costPerMonth = 25.00;
}
cout << 6.) How many years are you interest in hosting for?" << endl;
cin >> years;
It may seem a bit messy but im wracking by brain trying to solve it. what do you think? am i on the right track? Which statements/ operators am I missing? should I try incorporating switch statements? Any help is much appriciated.
Aucun commentaire:
Enregistrer un commentaire